TIOCSWINSZ(2const)

TIOCSWINSZ2const

Get and set window size

Usage

#include <asm/termbits.h>  /* Definition of TIOC*WINSZ constants */
#include <sys/ioctl.h>

int ioctl(int fd, TIOCGWINSZ, struct winsize *argp); int ioctl(int fd, TIOCSWINSZ, const struct winsize *argp);

#include <asm/termios.h>

struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; /* unused */ unsigned short ws_ypixel; /* unused */ };

Library

Standard C library (libc, -lc)

Overview

Window sizes are kept in the kernel, but not used by the kernel (except in the case of virtual consoles, where the kernel will update the window size when the size of the virtual console changes, for example, by loading a new font).

TIOCGWINSZ

Get window size.

TIOCSWINSZ

Set window size.

When the window size changes, a SIGWINCH signal is sent to the foreground process group.

Return value

On success, 0 is returned. On error, -1 is returned, and errno is set to indicate the error.

Releases

2 releases since Debian 13 (Trixie); the text changed 1 time.

  1. 13
  2. Arch

From man-pages 6.19-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.