IOCTL(2)
NAME
ioctl − control device
USAGE
#include <sys/ioctl.h>
ioctl(d, request, argp)
int d, request;
char *argp;
DESCRIPTION
Ioctl calls perform a variety of functions on open descriptors. In particular, ioctl requests can control the characteristics of character-special files (e.g., terminals).
An ioctl request specifies whether the argument is an “in” parameter or an “out” parameter, as well as the size of the argument argp in bytes. Macros and definitions used in specifying an ioctl request are in the file <sys/ioctl.h>.
NOTES
When ioctl is used in programs that deal with pads, setting the mode to RAW has the immediate effect of putting the pad into raw mode. Other ioctl parameters are stored and will be inherited by the VT100 program if it is subsequently invoked in that pad.
RETURN VALUE
If an error has occurred, a value of −1 is returned and errno is set to indicate the error.
ERRORS
Ioctl will fail if one or more of the following are true:
[EBADF] D is not a valid descriptor.
[ENOTTY] D is not associated with a character-special device.
[ENOTTY] The specified request does not apply to the kind of object that the descriptor d references.
[EINVAL] Request or argp is not valid.