STTY(3) Library Functions Manual STTY(3)

stty, gtty
set and get terminal state (defunct)

Compatibility Library (libcompat, -lcompat)

#include <sgtty.h>

stty(int fd, struct sgttyb *buf);

gtty(int fd, struct sgttyb *buf);

These interfaces are obsoleted by ioctl(2). They are available from the compatibility library, libcompat.

The stty() function sets the state of the terminal associated with fd. The gtty() function retrieves the state of the terminal associated with fd. To set the state of a terminal the call must have write permission.

The stty() call is actually ‘ioctl(fd, TIOCSETP, buf)’, while the gtty() call is ‘ioctl(fd, TIOCGETP, buf)’. See ioctl(2) and tty(4) for an explanation.

If the call is successful 0 is returned, otherwise -1 is returned and the global variable errno contains the reason for the failure.

ioctl(2), tty(4)

The stty() and gtty() functions appeared in Version 1 AT&T UNIX. Obsoleted by ioctl(2), these functions were moved to libcompat in 4.2BSD.
September 2, 2019 NetBSD 9.0