ioctl(2) System Calls Manual ioctl(2) ioctl - (libc -lc) #include int ioctl(int fd, unsigned long op, ...); /* glibc, BSD */ int ioctl(int fd, int op, ...); /* musl, other UNIX */ ioctl() . ( ) ioctl(). fd . . . char *argp ( void * C) . ioctl() op in out argp . ioctl() op . . . ioctl() . -1 errno . EBADF fd . EFAULT argp . EINVAL op argp . ENOTTY fd . ENOTTY fd. ioctl() ( / UNIX). . 7 AT&T UNIX ioctl(int fd, int op, struct sgttyb *argp); ( struct sgttyb stty(2) gtty(2) ( void * )). SysIII arg . 4.3BSD ioctl(int d, unsigned long op, char *argp); ( char * void *). SysVr4 int ioctl(int fd, int op, ... /* arg */); . open(2) Linux O_NONBLOCK. ioctl op Ioctl 32 . . Linux 16 () . : 0x03 ioctls HDIO_* 0x06 ioctls LP*. ASCII. TCGETS 0x00005401 0x54 = 'T' CYGETTIMEOUT 0x00435906 0x43 0x59 = 'C' 'Y' cyclades. (0.98p5) . 2 (00: 01: 10: 11: /) 14 ( ) 8 ( ioctls ) 8 . _IO(type,nr) {_IOR,_IOW,_IOWR}(type,nr,size). sizeof(size) size : . : sizeof(sizeof(struct)) . : . execve(2), fcntl(2), ioctl_console(2), ioctl_fat(2), ioctl_fs(2), ioctl_fsmap(2), ioctl_nsfs(2), ioctl_tty(2), ioctl_userfaultfd(2), ioctl_eventpoll(2), open(2), sd(4), tty(4) 3 . . : . 6.18 21 2025 ioctl(2)