70 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Groff
		
	
	
	
	
	
.\" Copyright (c) 1980 Regents of the University of California.
 | 
						|
.\" All rights reserved.  The Berkeley software License Agreement
 | 
						|
.\" specifies the terms and conditions for redistribution.
 | 
						|
.\"
 | 
						|
.\"	@(#)ioctl.2	6.3 (Berkeley) 3/4/86
 | 
						|
.\"
 | 
						|
.TH IOCTL 2 "March 4, 1986"
 | 
						|
.UC 4
 | 
						|
.SH NAME
 | 
						|
ioctl \- control device
 | 
						|
.SH SYNOPSIS
 | 
						|
.nf
 | 
						|
.ft B
 | 
						|
#include <sys/types.h>
 | 
						|
#include <sys/ioctl.h>
 | 
						|
 | 
						|
.ta +54n
 | 
						|
int ioctl(int \fId\fP, int \fIrequest\fP, void *\fIargp\fP)	(Minix)
 | 
						|
int ioctl(int \fId\fP, ioreq_t \fIrequest\fP, void *\fIargp\fP)	(Minix-vmd)
 | 
						|
.DT
 | 
						|
.fi
 | 
						|
.ft R
 | 
						|
.SH DESCRIPTION
 | 
						|
.B Ioctl
 | 
						|
performs a variety of functions
 | 
						|
on open descriptors.  In particular, many operating
 | 
						|
characteristics of character special files (e.g. terminals)
 | 
						|
may be controlled with
 | 
						|
.B ioctl
 | 
						|
requests.
 | 
						|
The writeups of various devices in section 4 discuss how
 | 
						|
.B ioctl
 | 
						|
applies to them.
 | 
						|
.PP
 | 
						|
An  ioctl
 | 
						|
.I request
 | 
						|
has encoded in it whether the argument is an \*(lqin\*(rq parameter
 | 
						|
or \*(lqout\*(rq parameter, and the size of the argument \fIargp\fP in bytes.
 | 
						|
Macros and defines used in specifying an ioctl
 | 
						|
.I request
 | 
						|
are located in the file
 | 
						|
.IR <sys/ioctl.h> .
 | 
						|
.SH "RETURN VALUE
 | 
						|
If an error has occurred, a value of \-1 is returned and
 | 
						|
.B errno
 | 
						|
is set to indicate the error.
 | 
						|
.SH ERRORS
 | 
						|
.B Ioctl
 | 
						|
will fail if one or more of the following are true:
 | 
						|
.TP 15
 | 
						|
[EBADF]
 | 
						|
\fID\fP is not a valid descriptor.
 | 
						|
.TP 15
 | 
						|
[ENOTTY]
 | 
						|
\fID\fP is not associated with a character
 | 
						|
special device.
 | 
						|
.TP 15
 | 
						|
[ENOTTY]
 | 
						|
The specified request does not apply to the kind
 | 
						|
of object that the descriptor \fId\fP references.
 | 
						|
.TP 15
 | 
						|
[EINVAL]
 | 
						|
\fIRequest\fP or \fIargp\fP is not valid.
 | 
						|
.SH "SEE ALSO"
 | 
						|
.BR execve (2),
 | 
						|
.BR fcntl (2),
 | 
						|
.BR mt (4),
 | 
						|
.BR tty (4),
 | 
						|
.BR intro (4).
 |