Perform a special file operation (fctnl) or IO control operation (ioctl). They are considered the same by the kernel (handled by the same code), however, using the correct function is recommended for portability.
Syntax
#include <fcntl.h>
int fctnl (int fd, int operation, ...);
#include <ioctl.h>
int ioctl (int fd, int operation, ...);
Parameters
-
fd
The file descriptor to use.
-
operation
The operation to perform, see below.
-
...
Optional extra argument. Only one extra argument is allowed/used.
Operation types
-
F_GETFL
Get file flags.
-
F_SETFL
Set file flags.
-
F_SETOWN
Set file owner. Required by some drivers for signal delivery.
Return Value
The return value is null if successful. Otherwise, the return value is negative and errno is set:
-
EBADF
Bad file descriptor.
Remarks
For driver operations, check the corresponding driver.