]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) 1993 Michael Haardt |
2 | .\" (michael@moria.de) | |
3 | .\" Fri Apr 2 11:32:09 MET DST 1993 | |
c13182ef | 4 | .\" |
e4a74ca8 | 5 | .\" SPDX-License-Identifier: GPL-2.0-or-later |
fea681da MK |
6 | .\" |
7 | .\" Modified Sat Jul 24 15:12:05 1993 by Rik Faith <faith@cs.unc.edu> | |
c13182ef | 8 | .\" Modified Tue Aug 1 16:27 1995 by Jochen Karrer |
fea681da MK |
9 | .\" <cip307@cip.physik.uni-wuerzburg.de> |
10 | .\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com> | |
11 | .\" Modified Mon Feb 15 17:28:41 CET 1999 by Andries E. Brouwer <aeb@cwi.nl> | |
c11b1abf | 12 | .\" Modified, 27 May 2004, Michael Kerrisk <mtk.manpages@gmail.com> |
fea681da MK |
13 | .\" Added notes on capability requirements |
14 | .\" | |
4c1c5274 | 15 | .TH ioperm 2 (date) "Linux man-pages (unreleased)" |
fea681da MK |
16 | .SH NAME |
17 | ioperm \- set port input/output permissions | |
2eed300b AC |
18 | .SH LIBRARY |
19 | Standard C library | |
8fc3b2cf | 20 | .RI ( libc ", " \-lc ) |
fea681da | 21 | .SH SYNOPSIS |
c7db92b9 | 22 | .nf |
2f8cb589 | 23 | .B #include <sys/io.h> |
68e4db0a | 24 | .PP |
fea681da | 25 | .BI "int ioperm(unsigned long " from ", unsigned long " num ", int " turn_on ); |
c7db92b9 | 26 | .fi |
fea681da | 27 | .SH DESCRIPTION |
60a90ecd | 28 | .BR ioperm () |
9a8235e2 | 29 | sets the port access permission bits for the calling thread for |
c3ec5c77 MK |
30 | .I num |
31 | bits starting from port address | |
32 | .IR from . | |
50b2aa27 | 33 | If |
c3ec5c77 MK |
34 | .I turn_on |
35 | is nonzero, then permission for the specified bits is enabled; | |
36 | otherwise it is disabled. | |
37 | If | |
38 | .I turn_on | |
39 | is nonzero, the calling thread must be privileged | |
5bb80360 | 40 | .RB ( CAP_SYS_RAWIO ). |
efeece04 | 41 | .PP |
5b9f466d MK |
42 | Before Linux 2.6.8, |
43 | only the first 0x3ff I/O ports could be specified in this manner. | |
f3634346 | 44 | For more ports, the |
0bfa087b | 45 | .BR iopl (2) |
4079fe37 MK |
46 | system call had to be used (with a |
47 | .I level | |
48 | argument of 3). | |
5b9f466d | 49 | Since Linux 2.6.8, 65,536 I/O ports can be specified. |
efeece04 | 50 | .PP |
b6e7016e | 51 | Permissions are inherited by the child created by |
daabaf99 | 52 | .BR fork (2) |
b6e7016e | 53 | (but see NOTES). |
51a138ce MK |
54 | Permissions are preserved across |
55 | .BR execve (2); | |
60b9e97c | 56 | this is useful for giving port access permissions to unprivileged |
51a138ce | 57 | programs. |
efeece04 | 58 | .PP |
fea681da MK |
59 | This call is mostly for the i386 architecture. |
60 | On many other architectures it does not exist or will always | |
61 | return an error. | |
47297adb | 62 | .SH RETURN VALUE |
c13182ef MK |
63 | On success, zero is returned. |
64 | On error, \-1 is returned, and | |
fea681da | 65 | .I errno |
f6a4078b | 66 | is set to indicate the error. |
fea681da MK |
67 | .SH ERRORS |
68 | .TP | |
69 | .B EINVAL | |
70 | Invalid values for | |
71 | .I from | |
72 | or | |
73 | .IR num . | |
74 | .TP | |
75 | .B EIO | |
51a138ce | 76 | (on PowerPC) This call is not supported. |
fea681da | 77 | .TP |
f3634346 MK |
78 | .B ENOMEM |
79 | .\" Could not allocate I/O bitmap. | |
80 | Out of memory. | |
81 | .TP | |
fea681da | 82 | .B EPERM |
9a8235e2 | 83 | The calling thread has insufficient privilege. |
3113c7f3 | 84 | .SH STANDARDS |
60a90ecd | 85 | .BR ioperm () |
8382f16d | 86 | is Linux-specific and should not be used in programs |
fea681da MK |
87 | intended to be portable. |
88 | .SH NOTES | |
5acc6d65 MK |
89 | The |
90 | .I /proc/ioports | |
91 | file shows the I/O ports that are currently allocated on the system. | |
efeece04 | 92 | .PP |
b6e7016e MK |
93 | Before Linux 2.4, |
94 | permissions were not inherited by a child created by | |
95 | .BR fork (2). | |
efeece04 | 96 | .PP |
abaa5fb0 MK |
97 | Glibc has an |
98 | .BR ioperm () | |
99 | prototype both in | |
fea681da MK |
100 | .I <sys/io.h> |
101 | and in | |
102 | .IR <sys/perm.h> . | |
103 | Avoid the latter, it is available on i386 only. | |
47297adb | 104 | .SH SEE ALSO |
fea681da | 105 | .BR iopl (2), |
22b87e13 | 106 | .BR outb (2), |
fea681da | 107 | .BR capabilities (7) |