Commit | Line | Data |
---|---|---|
aaea5b2e KB |
1 | .\" Copyright (c) 1980, 1991, 1993 |
2 | .\" The Regents of the University of California. All rights reserved. | |
384b8076 | 3 | .\" |
931b8415 | 4 | .\" %sccs.include.redist.man% |
384b8076 | 5 | .\" |
653ba8b6 | 6 | .\" @(#)ioctl.2 8.2 (Berkeley) %G% |
931b8415 CL |
7 | .\" |
8 | .Dd | |
9 | .Dt IOCTL 2 | |
10 | .Os BSD 4 | |
11 | .Sh NAME | |
12 | .Nm ioctl | |
13 | .Nd control device | |
14 | .Sh SYNOPSIS | |
15 | .Fd #include <sys/ioctl.h> | |
16 | .Ft int | |
17 | .Fn ioctl "int d" "unsigned long request" "char *argp" | |
18 | .Sh DESCRIPTION | |
19 | The | |
20 | .Fn ioctl | |
21 | function manipulates the underlying device parameters of special files. | |
22 | In particular, many operating | |
6234b5e5 KM |
23 | characteristics of character special files (e.g. terminals) |
24 | may be controlled with | |
931b8415 | 25 | .Fn ioctl |
6234b5e5 | 26 | requests. |
931b8415 CL |
27 | The argument |
28 | .Fa d | |
29 | must be an open file descriptor. | |
30 | .Pp | |
6234b5e5 | 31 | An ioctl |
931b8415 CL |
32 | .Fa request |
33 | has encoded in it whether the argument is an | |
34 | .Dq in | |
35 | parameter | |
36 | or | |
37 | .Dq out | |
38 | parameter, and the size of the argument | |
39 | .Fa argp | |
40 | in bytes. | |
6234b5e5 | 41 | Macros and defines used in specifying an ioctl |
931b8415 | 42 | .Fa request |
6234b5e5 | 43 | are located in the file |
931b8415 CL |
44 | .Ao Pa sys/ioctl.h Ac . |
45 | .Sh RETURN VALUES | |
46 | If an error has occurred, a value of -1 is returned and | |
47 | .Va errno | |
6234b5e5 | 48 | is set to indicate the error. |
931b8415 CL |
49 | .Sh ERRORS |
50 | .Fn Ioctl | |
653ba8b6 | 51 | will fail if: |
931b8415 CL |
52 | .Bl -tag -width [ENOTTY] |
53 | .It Bq Er EBADF | |
54 | .Fa d | |
55 | is not a valid descriptor. | |
56 | .It Bq Er ENOTTY | |
57 | .Fa d | |
58 | is not associated with a character | |
6234b5e5 | 59 | special device. |
931b8415 | 60 | .It Bq Er ENOTTY |
6234b5e5 | 61 | The specified request does not apply to the kind |
931b8415 CL |
62 | of object that the descriptor |
63 | .Fa d | |
64 | references. | |
65 | .It Bq Er EINVAL | |
66 | .Fa Request | |
67 | or | |
68 | .Fa argp | |
69 | is not valid. | |
70 | .El | |
71 | .Sh SEE ALSO | |
72 | .Xr mt 1 , | |
73 | .Xr execve 2 , | |
74 | .Xr fcntl 2 , | |
75 | .Xr tty 4 , | |
76 | .Xr intro 4 | |
77 | .Sh HISTORY | |
78 | An | |
79 | .Nm | |
80 | function call appeared in Version 7 AT&T UNIX. |