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