]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/iopl.2
prctl.2: ffix
[thirdparty/man-pages.git] / man2 / iopl.2
CommitLineData
fea681da
MK
1.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2.\" Portions extracted from linux/kernel/ioport.c (no copyright notice).
3.\"
93015253 4.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
fea681da
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 24.\" %%%LICENSE_END
fea681da 25.\"
c13182ef 26.\" Modified Tue Aug 1 16:47 1995 by Jochen Karrer
fea681da
MK
27.\" <cip307@cip.physik.uni-wuerzburg.de>
28.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
29.\" Modified Fri Nov 27 14:50:36 CET 1998 by Andries Brouwer <aeb@cwi.nl>
c11b1abf 30.\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
fea681da
MK
31.\" Added notes on capability requirements
32.\"
4b8c67d9 33.TH IOPL 2 2017-09-15 "Linux" "Linux Programmer's Manual"
fea681da
MK
34.SH NAME
35iopl \- change I/O privilege level
36.SH SYNOPSIS
37.B #include <sys/io.h>
68e4db0a 38.PP
fea681da
MK
39.BI "int iopl(int " level );
40.SH DESCRIPTION
e511ffb6 41.BR iopl ()
fd15ae83
MK
42changes the I/O privilege level of the calling process,
43as specified by the two least significant bits in
fea681da 44.IR level .
efeece04 45.PP
fea681da 46This call is necessary to allow 8514-compatible X servers to run under
c13182ef
MK
47Linux.
48Since these X servers require access to all 65536 I/O ports, the
0bfa087b 49.BR ioperm (2)
fea681da 50call is not sufficient.
efeece04 51.PP
fea681da 52In addition to granting unrestricted I/O port access, running at a higher
c13182ef
MK
53I/O privilege level also allows the process to disable interrupts.
54This will probably crash the system, and is not recommended.
efeece04 55.PP
38931a4d 56Permissions are not inherited by the child process created by
0bfa087b 57.BR fork (2)
38931a4d
MK
58and are not preserved across
59.BR execve (2)
60(but see NOTES).
efeece04 61.PP
fea681da 62The I/O privilege level for a normal process is 0.
efeece04 63.PP
fea681da
MK
64This call is mostly for the i386 architecture.
65On many other architectures it does not exist or will always
66return an error.
47297adb 67.SH RETURN VALUE
c13182ef
MK
68On success, zero is returned.
69On error, \-1 is returned, and
fea681da
MK
70.I errno
71is set appropriately.
72.SH ERRORS
73.TP
74.B EINVAL
75.I level
76is greater than 3.
77.TP
78.B ENOSYS
79This call is unimplemented.
80.TP
81.B EPERM
c13182ef 82The calling process has insufficient privilege to call
e511ffb6 83.BR iopl ();
fea681da
MK
84the
85.B CAP_SYS_RAWIO
7e6ba1f5
MK
86capability is required to raise the I/O privilege level
87above its current value.
47297adb 88.SH CONFORMING TO
60a90ecd 89.BR iopl ()
c8ceb0ca 90is Linux-specific and should not be used in programs that are
fea681da
MK
91intended to be portable.
92.SH NOTES
b6c261c4
MK
93.\" Libc5 treats it as a system call and has a prototype in
94.\" .IR <unistd.h> .
95.\" Glibc1 does not have a prototype.
c13182ef 96Glibc2 has a prototype both in
fea681da
MK
97.I <sys/io.h>
98and in
99.IR <sys/perm.h> .
100Avoid the latter, it is available on i386 only.
efeece04 101.PP
38931a4d
MK
102Prior to Linux 3.7,
103on some architectures (such as i386), permissions
104.I were
105inherited by the child produced by
106.BR fork (2)
107and were preserved across
108.BR execve (2).
109This behavior was inadvertently changed in Linux 3.7,
110and won't be reinstated.
47297adb 111.SH SEE ALSO
fea681da 112.BR ioperm (2),
4e726b9c 113.BR outb (2),
fea681da 114.BR capabilities (7)