OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man2 / iopl.2
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 2013-03-15 "Linux" "Linux Programmer's Manual"
34 .SH NAME
35 iopl \- change I/O privilege level
36 .SH SYNOPSIS
37 .B #include <sys/io.h>
38 .sp
39 .BI "int iopl(int " level );
40 .SH DESCRIPTION
41 .BR iopl ()
42 changes the I/O privilege level of the calling process,
43 as specified by the two least significant bits in
44 .IR level .
45
46 This call is necessary to allow 8514-compatible X servers to run under
47 Linux.
48 Since these X servers require access to all 65536 I/O ports, the
49 .BR ioperm (2)
50 call is not sufficient.
51
52 In addition to granting unrestricted I/O port access, running at a higher
53 I/O privilege level also allows the process to disable interrupts.
54 This will probably crash the system, and is not recommended.
55
56 Permissions are inherited by
57 .BR fork (2)
58 and
59 .BR execve (2).
60
61 The I/O privilege level for a normal process is 0.
62
63 This call is mostly for the i386 architecture.
64 On many other architectures it does not exist or will always
65 return an error.
66 .SH RETURN VALUE
67 On success, zero is returned.
68 On error, \-1 is returned, and
69 .I errno
70 is set appropriately.
71 .SH ERRORS
72 .TP
73 .B EINVAL
74 .I level
75 is greater than 3.
76 .TP
77 .B ENOSYS
78 This call is unimplemented.
79 .TP
80 .B EPERM
81 The calling process has insufficient privilege to call
82 .BR iopl ();
83 the
84 .B CAP_SYS_RAWIO
85 capability is required to raise the I/O privilege level
86 above its current value.
87 .SH CONFORMING TO
88 .BR iopl ()
89 is Linux-specific and should not be used in programs that are
90 intended to be portable.
91 .SH NOTES
92 Libc5 treats it as a system call and has a prototype in
93 .IR <unistd.h> .
94 Glibc1 does not have a prototype.
95 Glibc2 has a prototype both in
96 .I <sys/io.h>
97 and in
98 .IR <sys/perm.h> .
99 Avoid the latter, it is available on i386 only.
100 .SH SEE ALSO
101 .BR ioperm (2),
102 .BR outb (2),
103 .BR capabilities (7)
104 .SH COLOPHON
105 This page is part of release 3.79 of the Linux
106 .I man-pages
107 project.
108 A description of the project,
109 information about reporting bugs,
110 and the latest version of this page,
111 can be found at
112 \%http://www.kernel.org/doc/man\-pages/.