version 4, including all changes.
.
Rev |
Author |
# |
Line |
1 |
PerryLorier |
1 |
IOCTL |
|
|
2 |
!!!IOCTL |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
ERRORS |
|
|
8 |
CONFORMING TO |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
ioctl - control device |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
#include <sys/ioctl.h> |
|
|
19 |
|
|
|
20 |
|
|
|
21 |
__int ioctl(int__ ''d''__, int__ ''request''__,...)__ |
|
|
22 |
|
|
|
23 |
|
|
|
24 |
[[The "third" argument is __char *__''argp'', and will be so named for this |
|
|
25 |
discussion.] |
|
|
26 |
!!DESCRIPTION |
|
|
27 |
|
|
|
28 |
|
|
|
29 |
The __ioctl__ function manipulates the underlying device |
|
|
30 |
parameters of special files. In particular, many operating |
|
|
31 |
characteristics of character special files (e.g. terminals) |
|
|
32 |
may be controlled with __ioctl__ requests. The argument |
|
|
33 |
''d'' must be an open file descriptor. |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
An ioctl ''request'' has encoded in it whether the |
|
|
37 |
argument is an ''in'' parameter or ''out'' parameter, |
|
|
38 |
and the size of the argument ''argp'' in bytes. Macros |
|
|
39 |
and defines used in specifying an ioctl ''request'' are |
|
|
40 |
located in the file ''''. |
|
|
41 |
!!RETURN VALUE |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
Usually, on success zero is returned. A few ioctls use the |
|
|
45 |
return value as an output parameter and return a nonnegative |
|
|
46 |
value on success. On error, -1 is returned, and ''errno'' |
|
|
47 |
is set appropriately. |
|
|
48 |
!!ERRORS |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
;__EBADF__: ''d'' is not a valid descriptor. |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
;__EFAULT__: ''argp'' references an inaccessible memory area. |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
;__ENOTTY__: ''d'' is not associated with a character special device. |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
;__ENOTTY__: The specified request does not apply to the kind of object that the descriptor ''d'' references. |
|
|
61 |
|
|
|
62 |
|
|
|
63 |
;__EINVAL__: ''Request'' or ''argp'' is not valid. This normally happens if you've provided the wrong type of request for the file descriptor you passed to the ioctl |
|
|
64 |
|
|
|
65 |
!!CONFORMING TO |
|
|
66 |
|
|
|
67 |
|
|
|
68 |
No single standard. Arguments, returns, and semantics of ioctl(2) vary according to the device driver in question (the call is used as a catch-all for operations that don't cleanly fit the Unix stream I/O model). See |
4 |
!PerryLorier |
69 |
ioctl_list(2) for a list of many of the known __ioctl__ calls. The __ioctl__ function call appeared in Version 7 AT&T Unix. |
1 |
PerryLorier |
70 |
!!SEE ALSO |
|
|
71 |
|
|
|
72 |
|
|
|
73 |
execve(2), fcntl(2), ioctl_list(2), mt(4), sd(4), tty(4), netdevice(7), socket(7) |
|
|
74 |
---- |