ioctl()

perform device-specific control functions 

Function


SYNOPSIS

#include <unistd.h>

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


DESCRIPTION

The ioctl() function performs a variety of device-specific control functions on device special files. This function is supported for the following special file types:

Refer to the device-specific reference page listed in the SEE ALSO section for specific information on the ioctl() requests supported for each device.

The following generic requests are supported as well:

FIOCLEX 

The call ioctl(fildes, FIOCLEX, NULL) is equivalent to:

fcntl(fildes, F_SETFD, FD_CLOEXEC)
FIONCLEX 

The call ioctl(fildes, FIONCLEX, NULL) is equivalent to:

fcntl(fildes, F_SETFD, 0)


PARAMETERS

fildes 

Specifies an open file descriptor that refers to a device.

request 

Specifies the control function to be performed based upon the device being addressed.

... 

An optional third parameter (arg) for request-specific information. The data type depends upon the particular control request, but it is either an int or a pointer to a device-specific data structure.


RETURN VALUES

If successful, ioctl() returns a nonnegative integer value based on the device control function. On failure, it returns -1 and sets errno to one of the following values, or to another value described for the particular request.

EBADF 

The fildes parameter is not a valid open file descriptor.

EFAULT 

The request parameter requires a data transfer to or from a buffer that arg points to, but this pointer is invalid.

EINTR 

A signal interrupted the call.

EINVAL 

request or arg is not valid for this device.

EIO 

Some physical I/O error has occurred.

ENOTTY 

fildes is not associated with a device driver that accepts control functions.

ENXIO 

The request and arg parameters are valid for this device driver, but the service requested cannot be performed on this particular subdevice.


CONFORMANCE

UNIX 98, with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

ioctl() is inherently non-portable. the NuTCRACKER Platform supports only the documented ioctl() requests, only on the specified devices. Code that attempts to use any other requests, or on any other devices, must be revised.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
fcntl()

Miscellaneous:
/dev/com, /dev/console, sockets


PTC MKS Toolkit 10.4 Documentation Build 39.