---
name: "TIOCSWINSZ"
section: "2const"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/TIOCSWINSZ"
---

# TIOCSWINSZ(2const)

get and set window size

## NAME

TIOCGWINSZ, TIOCSWINSZ - get and set window size

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#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 \*/ **};**

## DESCRIPTION

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.

## SEE ALSO

[**ioctl**(2)](/ioctl/2.md), **ioctl\_tty**(2const)
