ioctl

Controls socket operations only.

Format

#include  <ioctl.h>

int ioctl  (int d, unsigned long request, void
           *arg);

Arguments

d
Specifies the file descriptor of the requested device.
request
Specifies the ioctl command performed on the device.
arg
Specifies parameters for this request. The type of arg is dependent on the specific ioctl request and device to which the ioctl is targeted.

Description

The ioctl routine performs a variety of operations on sockets.

An ioctl request has encoded in it, whether the parameter is an "in" parameter or "out" parameter, and the size of the arg parameter in bytes. The ioctl request is defined in the <ioctl.h> header file.

Return Values
Indicates success. 
-1  Indicates an error; further specified in the global errno. 

Errors
  If the ioctl routine fails, errno is set to one of the following values:

  • EBADF - The d parameter is not a valid descriptor.

  • ENOTTY - The d parameter is not associated with a character special device, or the specified request does not apply to the kind of object that the d parameter references.

  • EINVAL - Either the request or the arg parameter is not valid.
 


Previous Page | Next Page | Table of Contents | Index