I/O Control

Headers

#include <unistd.h>
#include <sys/ioctl.h>

Function Prototype

int ioctl(int filedes, int request, ...)
  • request 代表我想要做什麼操作

Catchall

因為在 UNIX 中「萬物皆文件」,而因為不同設備有不同的 properties,所以我們之前介紹的 system call 不足以控制所有設備

而 ioctl 有點像是「其他」選項,也就是如果你有什麼需求在其他 system call 中找不到,那你一定可以用 ioctl 做到