ioctl

Performs a variety of control functions on a FIFO or socket.

Library:LibC
Classification:POSIX
Service:File and Directory I/O

Syntax

  #include <unistd.h> 
   
  int ioctl (
     int    fildes,   
     int    request,   
     ...);
  

Parameters

fildes

(IN) Specifies a descriptor returned from the open, pipe, sopen, or socket function.

request

(IN) Specifies the control function to be performed.

...

(IN/OUT) Points to an additional argument to be used or points to an argument returned by ioctl (depending on the control function performed).

Return Values

If successful, returns a value dependent upon the control function (request parameter) but must be a nonnegative integer. Otherwise, returns -1 and sets errno to one of the following:

Decimal

Constant

Description

4

EBADF

The fildes parameter is not a valid descriptor.

9

EINVAL

The request or the argument for the request is invalid.

75

ENOTTY

The fildes parameter does not specify a character special device.

The request does not apply to the specified device.

Remarks

The ioctl function manipulates the underlying device parameters of special files, such as FIFOs and BSD sockets.

See Also