scripts/bash_aliases: tfix
[man-pages.git] / man2 / iopl.2
blobf0a241b97c40eea7b34de253d5426fc21b0f90c9
1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\" Portions extracted from linux/kernel/ioport.c (no copyright notice).
3 .\"
4 .\" %%%LICENSE_START(VERBATIM)
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.
13 .\"
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.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\" %%%LICENSE_END
25 .\"
26 .\" Modified Tue Aug  1 16:47    1995 by Jochen Karrer
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>
30 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
31 .\"     Added notes on capability requirements
32 .\"
33 .TH IOPL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
34 .SH NAME
35 iopl \- change I/O privilege level
36 .SH SYNOPSIS
37 .nf
38 .B #include <sys/io.h>
39 .PP
40 .BI "int iopl(int " level );
41 .fi
42 .SH DESCRIPTION
43 .BR iopl ()
44 changes the I/O privilege level of the calling thread,
45 as specified by the two least significant bits in
46 .IR level .
47 .PP
48 The I/O privilege level for a normal thread is 0.
49 Permissions are inherited from parents to children.
50 .PP
51 This call is deprecated, is significantly slower than
52 .BR ioperm (2),
53 and is only provided for older X servers which require
54 access to all 65536 I/O ports.
55 It is mostly for the i386 architecture.
56 On many other architectures it does not exist or will always
57 return an error.
58 .SH RETURN VALUE
59 On success, zero is returned.
60 On error, \-1 is returned, and
61 .I errno
62 is set to indicate the error.
63 .SH ERRORS
64 .TP
65 .B EINVAL
66 .I level
67 is greater than 3.
68 .TP
69 .B ENOSYS
70 This call is unimplemented.
71 .TP
72 .B EPERM
73 The calling thread has insufficient privilege to call
74 .BR iopl ();
75 the
76 .B CAP_SYS_RAWIO
77 capability is required to raise the I/O privilege level
78 above its current value.
79 .SH CONFORMING TO
80 .BR iopl ()
81 is Linux-specific and should not be used in programs that are
82 intended to be portable.
83 .SH NOTES
84 .\" Libc5 treats it as a system call and has a prototype in
85 .\" .IR <unistd.h> .
86 .\" Glibc1 does not have a prototype.
87 Glibc2 has a prototype both in
88 .I <sys/io.h>
89 and in
90 .IR <sys/perm.h> .
91 Avoid the latter, it is available on i386 only.
92 .PP
93 Prior to Linux 5.5
94 .BR iopl ()
95 allowed the thread to disable interrupts while running
96 at a higher I/O privilege level.
97 This will probably crash the system, and is not recommended.
98 .PP
99 Prior to Linux 3.7,
100 on some architectures (such as i386), permissions
101 .I were
102 inherited by the child produced by
103 .BR fork (2)
104 and were preserved across
105 .BR execve (2).
106 This behavior was inadvertently changed in Linux 3.7,
107 and won't be reinstated.
108 .SH SEE ALSO
109 .BR ioperm (2),
110 .BR outb (2),
111 .BR capabilities (7)