1IOCTL(2) System Calls Manual IOCTL(2)
2
3
4
6 ioctl - control device
7
9 #include <sys/ioctl.h>
10
11 ioctl(d, request, argp)
12 int d;
13 unsigned long request;
14 char *argp;
15
17 Ioctl performs a variety of functions on open descriptors. In particu‐
18 lar, many operating characteristics of character special files (e.g.
19 terminals) may be controlled with ioctl requests. The writeups of var‐
20 ious devices in section 4 discuss how ioctl applies to them.
21
22 An ioctl request has encoded in it whether the argument is an “in”
23 parameter or “out” parameter, and the size of the argument argp in
24 bytes. Macros and defines used in specifying an ioctl request are
25 located in the file <sys/ioctl.h>.
26
28 If an error has occurred, a value of -1 is returned and errno is set to
29 indicate the error.
30
32 Ioctl will fail if one or more of the following are true:
33
34 [EBADF] D is not a valid descriptor.
35
36 [ENOTTY] D is not associated with a character special device.
37
38 [ENOTTY] The specified request does not apply to the kind of
39 object that the descriptor d references.
40
41 [EINVAL] Request or argp is not valid.
42
44 execve(2), fcntl(2), mt(4), tty(4), intro(4N)
45
46
47
484th Berkeley Distribution March 4, 1986 IOCTL(2)