ioctl.2freebsd

Langue: en

Version: 265842 (debian - 07/07/09)

Section: 2 (Appels système)


BSD mandoc

NAME

ioctl - control device

LIBRARY

Lb libc

SYNOPSIS

In sys/ioctl.h Ft int Fn ioctl int d unsigned long request ...

DESCRIPTION

The Fn ioctl system call manipulates the underlying device parameters of special files. In particular, many operating characteristics of character special files (e.g. terminals) may be controlled with Fn ioctl requests. The argument Fa d must be an open file descriptor.

The third argument to Fn ioctl is traditionally named char *argp Most uses of Fn ioctl , however, require the third argument to be a Vt caddr_t or an Vt int .

An Fn ioctl Fa request has encoded in it whether the argument is an ``in'' argument or ``out'' argument, and the size of the argument Fa argp in bytes. Macros and defines used in specifying an ioctl Fa request are located in the file In sys/ioctl.h .

RETURN VALUES

If an error has occurred, a value of -1 is returned and errno is set to indicate the error.

ERRORS

The Fn ioctl system call will fail if:
Bq Er EBADF
The Fa d argument is not a valid descriptor.
Bq Er ENOTTY
The Fa d argument is not associated with a character special device.
Bq Er ENOTTY
The specified request does not apply to the kind of object that the descriptor Fa d references.
Bq Er EINVAL
The Fa request or Fa argp argument is not valid.
Bq Er EFAULT
The Fa argp argument points outside the process's allocated address space.

SEE ALSO

execve(2), fcntl(2), intro(4), tty(4)

HISTORY

The Fn ioctl function appeared in AT&T System v7 .