Add copyright
[unix-history] / usr / src / lib / libc / sys / ioctl.2
CommitLineData
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 10ioctl \- 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
17ioctl(d, request, argp)
18int d, request;
19char *argp;
384b8076 20.fi
6234b5e5 21.ft R
384b8076
KM
22.SH DESCRIPTION
23.I Ioctl
24performs a variety of functions
6234b5e5
KM
25on open descriptors. In particular, many operating
26characteristics of character special files (e.g. terminals)
27may be controlled with
28.I ioctl
29requests.
30The writeups of various devices in section 4 discuss how
384b8076
KM
31.I ioctl
32applies to them.
33.PP
6234b5e5 34An ioctl
384b8076 35.I request
6234b5e5
KM
36has encoded in it whether the argument is an \*(lqin\*(rq parameter
37or \*(lqout\*(rq parameter, and the size of the argument \fIargp\fP in bytes.
38Macros and defines used in specifying an ioctl
39.I request
40are located in the file
41.IR <sys/ioctl.h> .
42.SH "RETURN VALUE
43If an error has occurred, a value of \-1 is returned and
44.I errno
45is set to indicate the error.
46.SH ERRORS
384b8076 47.I Ioctl
6234b5e5
KM
48will 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
55special device.
56.TP 15
57[ENOTTY]
58The specified request does not apply to the kind
59of 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"
64execve(2), fcntl(2), mt(4), tty(4), intro(4N)