ioctl

Name

ioctl -- control device

Synopsis

#include <sys/ioctl.h>

int ioctl(int d, int request ...);

Description

ioctl manipulates the underlying device parameters of special files. d must be an open file descriptor. The type and value of the third parameter is dependent on the device and request.

An application may not call ioctl except for situations explicitly stated in this specification.

Return Value

On success, 0 is returned. An ioctl may use the return value as an output parameter and return a non-negative value on success. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EBADF

d is not a valid descriptor.

EFAULT

The third parameter references an inaccessible memory area.

ENOTTY

d is not associated with a character special device.

ENOTTY

The specified request does not apply to the kind of object that d references.

EINVAL

request or the third parameter is not valid.