Debian Codegraph @

upstream/debian-unstable/man2/iopl.2

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