All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
@(#)ioctl.2 4.1 (Berkeley) 05/09/85
#include <sgtty.h>ioctl(fildes, request, argp) struct sgttyb *argp;
stty(fildes, argp) struct sgttyb *argp;
gtty(fildes, argp) struct sgttyb *argp;
For certain status setting and status inquiries about terminal devices, the functions stty and gtty are equivalent to
ioctl(fildes, TIOCSETP, argp)
ioctl(fildes, TIOCGETP, argp)
respectively; see tty (4).
The following two standard calls, however, apply to any open file:
ioctl(fildes, FIOCLEX, NULL);
ioctl(fildes, FIONCLEX, NULL);
The first causes the file to be closed automatically during a successful exec operation; the second reverses the effect of the first.
The following call is peculiar to the Berkeley implementation, and also applies to any open file:
ioctl(fildes, FIONREAD, &count)
returning, in the longword count the number of characters available for reading from fildes.
Ioctl calls which attempt to modify the state of a process control terminal while a process is not in the process group of the control terminal will cause a SIGTTOU signal to be sent to the process' process group. Such ioctl s are allowed, however, if SIGTTOU is being held, ignored, if the process is an orphan which has been inherited by init , or is the child in an incomplete vfork (see jobs (3))
The important thing is that the size is fixed by `struct sgttyb'.
sys ioctl; fildes; request; argp
(stty = 31.)
(file descriptor in r0)
stty; argp
(gtty = 32.)
(file descriptor in r0)
sys gtty; argp