Terminal I/O function ioctl

    The ioctl function has always been a glove box for I/O operations, and operations that cannot be performed with other I/O functions can usually be represented using it. Terminal I/O is where the ioctl functions are used the most, to get and set the size of the terminal window, etc. (POSIX.1 has replaced terminal I/O operations with separate functions).
#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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326225014&siteId=291194637