int devctl(int fd, unsigned long request, void *argument, size_t nbytes, int *info);
This syscall interfaces with device files in device-specific ways. fd
points to the desired device to interface with, request is a
device-specific integer value that specifies that desired operation,
argument points to a device-specific argument of length nbytes.
info reports further error information depending on the device if not
NULL, or 0 if no further info is provided.
nbytes can be ignored by passing 0, which allows very ioctl-like
semantics. This is provided for easy ioctl implementation and usage
from userland. By using nbytes = 0, ioctl can be implemented as
devctl(fd, req, arg, 0, NULL).
devctl returns 0 on success and -1 on failure, and sets the
following errno:
ENOTTY: The passed file does not support the passed request.
EBADF: The passed file does not exist for the process.
EFAULT: The passed argument is in non-accessible memory