#include <unistd.h> /* System V */ #include <sys/ioctl.h> /* BSD and Linux */ int ioctl(int fd, int request, ...); /* 返回值:若出错,返回 -1;否则,返回其他值 */
在此原型中,表示的只是 ioctl 函数本身所要求的头文件。通常,还要求另外的设备专用头文件。例如,除 POSIX.1 所说明的基本操作之外,终端 I/O 的 ioctl 命令都需要头文件<termios.h>。
每个设备驱动程序都可以定义它自己专用的一组 ioctl 命令,系统则为不同种类的设备提供通用的 ioctl 命令。