.\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)ioctl.2 8.2 (Berkeley) 12/11/93 .\" .TH IOCTL 2 "16 January 1997" GNO "System Calls" .SH NAME .BR ioctl \- control device .SH SYNOPSIS .br #include .sp 1 int \fBioctl\fR (int \fId\fR, unsigned long \fIrequest\fR, void *\fIargp\fR); .SH DESCRIPTION The .BR ioctl function manipulates the underlying device parameters of special files. In particular, many operating characteristics of character special files (e.g. terminals) may be controlled with .BR ioctl requests. The argument .I d must be an open file descriptor. .LP An ioctl .I request has encoded in it whether the argument is an 'in' parameter or 'out' parameter, and the size of the argument .I argp in bytes. Macros and defines used in specifying an ioctl .I request are located in the file . .LP The writeups of various devices in chapter 4 discuss how .BR ioctl applies to them. .SH RETURN VALUES If an error has occurred, a value of -1 is returned and .IR errno is set to indicate the error. .SH ERRORS .BR Ioctl will fail if: .RS .IP \fBEBADF\fR .I d is not a valid descriptor. .IP \fBENOTTY\fR .I d is not associated with a character special device. .IP \fBENOTTY\fR The specified request does not apply to the kind of object that the descriptor .I d references. .IP \fBEINVAL\fR .I Request or .I argp is not valid. .RE .SH SEE ALSO .BR mt (1), .BR execve (2), .BR fcntl (2), .BR tty (4), .BR intro (4) .SH HISTORY An .BR ioctl function call appeared in Version 7 AT&T UNIX.