ioctl is a bit of a ragbag of things. It provides an interface for controlling the behavior of devices and their descriptors and configuring underlying services. Terminals, file descriptors, sockets, and even tape drives may have ioctlcalls defined for them and you need to refer to the specific device’s manpage for details. POSIX defines only ioctlfor streams. Here’s the syntax:
#include
int ioctl(int fildes, int cmd, ...);
ioctl performs the function indicated by cmdon the object referenced by the descriptor fildes. It may take an optional third argument, depending on the functions supported by a particular device.