| 1 |
.\" Copyright 1993 Rickard E. Faith ([email protected]) |
| 2 |
.\" Portions extracted from linux/kernel/ioport.c (no copyright notice). |
| 3 |
.\" |
| 4 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 5 |
.\" |
| 6 |
.\" Modified Tue Aug 1 16:47 1995 by Jochen Karrer |
| 7 |
.\" <[email protected]> |
| 8 |
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <[email protected]> |
| 9 |
.\" Modified Fri Nov 27 14:50:36 CET 1998 by Andries Brouwer <[email protected]> |
| 10 |
.\" Modified, 27 May 2004, Michael Kerrisk <[email protected]> |
| 11 |
.\" Added notes on capability requirements |
| 12 |
.\" |
| 13 |
.TH iopl 2 2024-05-02 "Linux man-pages 6.9.1" |
| 14 |
.SH NAME |
| 15 |
iopl \- change I/O privilege level |
| 16 |
.SH LIBRARY |
| 17 |
Standard C library |
| 18 |
.RI ( libc ", " \-lc ) |
| 19 |
.SH SYNOPSIS |
| 20 |
.nf |
| 21 |
.B #include <sys/io.h> |
| 22 |
.P |
| 23 |
.BI "[[deprecated]] int iopl(int " level ); |
| 24 |
.fi |
| 25 |
.SH DESCRIPTION |
| 26 |
.BR iopl () |
| 27 |
changes the I/O privilege level of the calling thread, |
| 28 |
as specified by the two least significant bits in |
| 29 |
.IR level . |
| 30 |
.P |
| 31 |
The I/O privilege level for a normal thread is 0. |
| 32 |
Permissions are inherited from parents to children. |
| 33 |
.P |
| 34 |
This call is deprecated, is significantly slower than |
| 35 |
.BR ioperm (2), |
| 36 |
and is only provided for older X servers which require |
| 37 |
access to all 65536 I/O ports. |
| 38 |
It is mostly for the i386 architecture. |
| 39 |
On many other architectures it does not exist or will always |
| 40 |
return an error. |
| 41 |
.SH RETURN VALUE |
| 42 |
On success, zero is returned. |
| 43 |
On error, \-1 is returned, and |
| 44 |
.I errno |
| 45 |
is set to indicate the error. |
| 46 |
.SH ERRORS |
| 47 |
.TP |
| 48 |
.B EINVAL |
| 49 |
.I level |
| 50 |
is greater than 3. |
| 51 |
.TP |
| 52 |
.B ENOSYS |
| 53 |
This call is unimplemented. |
| 54 |
.TP |
| 55 |
.B EPERM |
| 56 |
The calling thread has insufficient privilege to call |
| 57 |
.BR iopl (); |
| 58 |
the |
| 59 |
.B CAP_SYS_RAWIO |
| 60 |
capability is required to raise the I/O privilege level |
| 61 |
above its current value. |
| 62 |
.SH VERSIONS |
| 63 |
.\" Libc5 treats it as a system call and has a prototype in |
| 64 |
.\" .IR <unistd.h> . |
| 65 |
.\" glibc1 does not have a prototype. |
| 66 |
glibc2 has a prototype both in |
| 67 |
.I <sys/io.h> |
| 68 |
and in |
| 69 |
.IR <sys/perm.h> . |
| 70 |
Avoid the latter, it is available on i386 only. |
| 71 |
.SH STANDARDS |
| 72 |
Linux. |
| 73 |
.SH HISTORY |
| 74 |
Prior to Linux 5.5 |
| 75 |
.BR iopl () |
| 76 |
allowed the thread to disable interrupts while running |
| 77 |
at a higher I/O privilege level. |
| 78 |
This will probably crash the system, and is not recommended. |
| 79 |
.P |
| 80 |
Prior to Linux 3.7, |
| 81 |
on some architectures (such as i386), permissions |
| 82 |
.I were |
| 83 |
inherited by the child produced by |
| 84 |
.BR fork (2) |
| 85 |
and were preserved across |
| 86 |
.BR execve (2). |
| 87 |
This behavior was inadvertently changed in Linux 3.7, |
| 88 |
and won't be reinstated. |
| 89 |
.SH SEE ALSO |
| 90 |
.BR ioperm (2), |
| 91 |
.BR outb (2), |
| 92 |
.BR capabilities (7) |