]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/ioperm.2
Many pages: Use correct letter case in page titles (TH)
[thirdparty/man-pages.git] / man2 / ioperm.2
CommitLineData
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
17ioperm \- set port input/output permissions
2eed300b
AC
18.SH LIBRARY
19Standard 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 29sets the port access permission bits for the calling thread for
c3ec5c77
MK
30.I num
31bits starting from port address
32.IR from .
50b2aa27 33If
c3ec5c77
MK
34.I turn_on
35is nonzero, then permission for the specified bits is enabled;
36otherwise it is disabled.
37If
38.I turn_on
39is nonzero, the calling thread must be privileged
5bb80360 40.RB ( CAP_SYS_RAWIO ).
efeece04 41.PP
5b9f466d
MK
42Before Linux 2.6.8,
43only the first 0x3ff I/O ports could be specified in this manner.
f3634346 44For more ports, the
0bfa087b 45.BR iopl (2)
4079fe37
MK
46system call had to be used (with a
47.I level
48argument of 3).
5b9f466d 49Since Linux 2.6.8, 65,536 I/O ports can be specified.
efeece04 50.PP
b6e7016e 51Permissions are inherited by the child created by
daabaf99 52.BR fork (2)
b6e7016e 53(but see NOTES).
51a138ce
MK
54Permissions are preserved across
55.BR execve (2);
60b9e97c 56this is useful for giving port access permissions to unprivileged
51a138ce 57programs.
efeece04 58.PP
fea681da
MK
59This call is mostly for the i386 architecture.
60On many other architectures it does not exist or will always
61return an error.
47297adb 62.SH RETURN VALUE
c13182ef
MK
63On success, zero is returned.
64On error, \-1 is returned, and
fea681da 65.I errno
f6a4078b 66is set to indicate the error.
fea681da
MK
67.SH ERRORS
68.TP
69.B EINVAL
70Invalid values for
71.I from
72or
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.
80Out of memory.
81.TP
fea681da 82.B EPERM
9a8235e2 83The calling thread has insufficient privilege.
3113c7f3 84.SH STANDARDS
60a90ecd 85.BR ioperm ()
8382f16d 86is Linux-specific and should not be used in programs
fea681da
MK
87intended to be portable.
88.SH NOTES
5acc6d65
MK
89The
90.I /proc/ioports
91file shows the I/O ports that are currently allocated on the system.
efeece04 92.PP
b6e7016e
MK
93Before Linux 2.4,
94permissions were not inherited by a child created by
95.BR fork (2).
efeece04 96.PP
abaa5fb0
MK
97Glibc has an
98.BR ioperm ()
99prototype both in
fea681da
MK
100.I <sys/io.h>
101and in
102.IR <sys/perm.h> .
103Avoid 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)