OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man2 / ioperm.2
1 .\" Copyright (c) 1993 Michael Haardt
2 .\" (michael@moria.de)
3 .\" Fri Apr  2 11:32:09 MET DST 1993
4 .\"
5 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
6 .\" This is free documentation; you can redistribute it and/or
7 .\" modify it under the terms of the GNU General Public License as
8 .\" published by the Free Software Foundation; either version 2 of
9 .\" the License, or (at your option) any later version.
10 .\"
11 .\" The GNU General Public License's references to "object code"
12 .\" and "executables" are to be interpreted as the output of any
13 .\" document formatting or typesetting system, including
14 .\" intermediate and printed output.
15 .\"
16 .\" This manual is distributed in the hope that it will be useful,
17 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
18 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 .\" GNU General Public License for more details.
20 .\"
21 .\" You should have received a copy of the GNU General Public
22 .\" License along with this manual; if not, see
23 .\" <http://www.gnu.org/licenses/>.
24 .\" %%%LICENSE_END
25 .\"
26 .\" Modified Sat Jul 24 15:12:05 1993 by Rik Faith <faith@cs.unc.edu>
27 .\" Modified Tue Aug  1 16:27    1995 by Jochen Karrer
28 .\"                              <cip307@cip.physik.uni-wuerzburg.de>
29 .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
30 .\" Modified Mon Feb 15 17:28:41 CET 1999 by Andries E. Brouwer <aeb@cwi.nl>
31 .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com>
32 .\"     Added notes on capability requirements
33 .\"
34 .TH IOPERM 2 2014-08-19 "Linux" "Linux Programmer's Manual"
35 .SH NAME
36 ioperm \- set port input/output permissions
37 .SH SYNOPSIS
38 .B #include <sys/io.h>
39 /* for glibc */
40 .sp
41 .BI "int ioperm(unsigned long " from ", unsigned long " num ", int " turn_on );
42 .SH DESCRIPTION
43 .BR ioperm ()
44 sets the port access permission bits for the calling thread for
45 .I num
46 bits starting from port address
47 .IR from .
48 If
49 .I turn_on
50 is nonzero, then permission for the specified bits is enabled;
51 otherwise it is disabled.
52 If
53 .I turn_on
54 is nonzero, the calling thread must be privileged
55 .RB ( CAP_SYS_RAWIO ).
56
57 Before Linux 2.6.8,
58 only the first 0x3ff I/O ports could be specified in this manner.
59 For more ports, the
60 .BR iopl (2)
61 system call had to be used (with a
62 .I level
63 argument of 3).
64 Since Linux 2.6.8, 65,536 I/O ports can be specified.
65
66 Permissions are not inherited by the child created by
67 .BR fork (2);
68 following a
69 .BR fork (2)
70 the child must turn on those permissions that it needs.
71 Permissions are preserved across
72 .BR execve (2);
73 this is useful for giving port access permissions to unprivileged
74 programs.
75
76 This call is mostly for the i386 architecture.
77 On many other architectures it does not exist or will always
78 return an error.
79 .SH RETURN VALUE
80 On success, zero is returned.
81 On error, \-1 is returned, and
82 .I errno
83 is set appropriately.
84 .SH ERRORS
85 .TP
86 .B EINVAL
87 Invalid values for
88 .I from
89 or
90 .IR num .
91 .TP
92 .B EIO
93 (on PowerPC) This call is not supported.
94 .TP
95 .B ENOMEM
96 .\" Could not allocate I/O bitmap.
97 Out of memory.
98 .TP
99 .B EPERM
100 The calling thread has insufficient privilege.
101 .SH CONFORMING TO
102 .BR ioperm ()
103 is Linux-specific and should not be used in programs
104 intended to be portable.
105 .SH NOTES
106 The
107 .I /proc/ioports
108 file shows the I/O ports that are currently allocated on the system.
109
110 Glibc has an
111 .BR ioperm ()
112 prototype both in
113 .I <sys/io.h>
114 and in
115 .IR <sys/perm.h> .
116 Avoid the latter, it is available on i386 only.
117 .SH SEE ALSO
118 .BR iopl (2),
119 .BR outb (2),
120 .BR capabilities (7)
121 .SH COLOPHON
122 This page is part of release 3.79 of the Linux
123 .I man-pages
124 project.
125 A description of the project,
126 information about reporting bugs,
127 and the latest version of this page,
128 can be found at
129 \%http://www.kernel.org/doc/man\-pages/.