| 1 |
.\" Copyright 2002, Walter Harms <[email protected]> |
| 2 |
.\" Copyright 2002, Andries E. Brouwer <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: GPL-1.0-or-later |
| 6 |
.\" |
| 7 |
.TH TIOCSWINSZ 2const 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
TIOCGWINSZ, |
| 10 |
TIOCSWINSZ |
| 11 |
\- |
| 12 |
get and set window size |
| 13 |
.SH LIBRARY |
| 14 |
Standard C library |
| 15 |
.RI ( libc ,\~ \-lc ) |
| 16 |
.SH SYNOPSIS |
| 17 |
.nf |
| 18 |
.BR "#include <asm/termbits.h>" " /* Definition of " TIOC*WINSZ " constants */" |
| 19 |
.B #include <sys/ioctl.h> |
| 20 |
.P |
| 21 |
.BI "int ioctl(int " fd ", TIOCGWINSZ, struct winsize *" argp ); |
| 22 |
.BI "int ioctl(int " fd ", TIOCSWINSZ, const struct winsize *" argp ); |
| 23 |
.P |
| 24 |
.B #include <asm/termios.h> |
| 25 |
.P |
| 26 |
.B struct winsize { |
| 27 |
.B " unsigned short ws_row;" |
| 28 |
.B " unsigned short ws_col;" |
| 29 |
.BR " unsigned short ws_xpixel;" " /* unused */" |
| 30 |
.BR " unsigned short ws_ypixel;" " /* unused */" |
| 31 |
.B }; |
| 32 |
.fi |
| 33 |
.SH DESCRIPTION |
| 34 |
Window sizes are kept in the kernel, but not used by the kernel |
| 35 |
(except in the case of virtual consoles, where the kernel will |
| 36 |
update the window size when the size of the virtual console changes, |
| 37 |
for example, by loading a new font). |
| 38 |
.TP |
| 39 |
.B TIOCGWINSZ |
| 40 |
Get window size. |
| 41 |
.TP |
| 42 |
.B TIOCSWINSZ |
| 43 |
Set window size. |
| 44 |
.P |
| 45 |
When the window size changes, a |
| 46 |
.B SIGWINCH |
| 47 |
signal is sent to the |
| 48 |
foreground process group. |
| 49 |
.SH RETURN VALUE |
| 50 |
On success, |
| 51 |
0 is returned. |
| 52 |
On error, |
| 53 |
\-1 is returned, and |
| 54 |
.I errno |
| 55 |
is set to indicate the error. |
| 56 |
.SH SEE ALSO |
| 57 |
.BR ioctl (2), |
| 58 |
.BR ioctl_tty (2const) |