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