#include <unistd.h> /* System V */ #include <sys/ioctl.h> /* BSD and Linux */ int ioctl(int fd, int request, ...); /* Return value: if there is an error, return -1; otherwise, return other values */
In this prototype, only the header files required by the ioctl function itself are represented. Typically, additional device-specific header files are also required. For example, the header file <termios.h> is required for ioctl commands for terminal I/O in addition to the basic operations described by POSIX.1.
Each device driver can define its own dedicated set of ioctl commands, and the system provides generic ioctl commands for different kinds of devices.