Commit | Line | Data |
---|---|---|
ab9bb6ba C |
1 | .TH IOCTL 2 "7 July 1983" |
2 | .UC 4 | |
3 | .SH NAME | |
4 | ioctl \- control device | |
5 | .SH SYNOPSIS | |
6 | .nf | |
7 | .ft B | |
8 | #include <sys/ioctl.h> | |
9 | .PP | |
10 | .ft B | |
11 | ioctl(d, request, argp) | |
12 | int d, request; | |
13 | char *argp; | |
14 | .fi | |
15 | .ft R | |
16 | .SH DESCRIPTION | |
17 | .I Ioctl | |
18 | performs a variety of functions | |
19 | on open descriptors. In particular, many operating | |
20 | characteristics of character special files (e.g. terminals) | |
21 | may be controlled with | |
22 | .I ioctl | |
23 | requests. | |
24 | The writeups of various devices in section 4 discuss how | |
25 | .I ioctl | |
26 | applies to them. | |
27 | .PP | |
28 | An ioctl | |
29 | .I request | |
30 | has encoded in it whether the argument is an \*(lqin\*(rq parameter | |
31 | or \*(lqout\*(rq parameter, and the size of the argument \fIargp\fP in bytes. | |
32 | Macros and defines used in specifying an ioctl | |
33 | .I request | |
34 | are located in the file | |
35 | .IR <sys/ioctl.h> . | |
36 | .SH "RETURN VALUE | |
37 | If an error has occurred, a value of \-1 is returned and | |
38 | .I errno | |
39 | is set to indicate the error. | |
40 | .SH ERRORS | |
41 | .I Ioctl | |
42 | will fail if one or more of the following are true: | |
43 | .TP 15 | |
44 | [EBADF] | |
45 | \fID\fP is not a valid descriptor. | |
46 | .TP 15 | |
47 | [ENOTTY] | |
48 | \fID\fP is not associated with a character | |
49 | special device. | |
50 | .TP 15 | |
51 | [ENOTTY] | |
52 | The specified request does not apply to the kind | |
53 | of object which the descriptor \fId\fP references. | |
54 | .TP 15 | |
55 | [EINVAL] | |
56 | \fIRequest\fP or \fIargp\fP is not valid. | |
57 | .SH "SEE ALSO" | |
58 | execve(2), fcntl(2), mt(4), tty(4), intro(4N) |