1IOPERM(2) Linux Programmer's Manual IOPERM(2)
2
3
4
6 ioperm - set port input/output permissions
7
9 #include <unistd.h> /* for libc5 */
10 #include <sys/io.h> /* for glibc */
11
12 int ioperm(unsigned long from, unsigned long num, int turn_on);
13
15 ioperm() sets the port access permission bits for the calling process
16 for num bytes starting from port address from to the value turn_on. If
17 turn_on is non-zero, the calling process must be privileged
18 (CAP_SYS_RAWIO).
19
20 Only the first 0x3ff I/O ports can be specified in this manner. For
21 more ports, the iopl(2) system call must be used.
22
23 Permissions are not inherited by the child created by fork(2). Permis‐
24 sions are preserved across execve(2); this is useful for giving port
25 access permissions to non-privileged programs.
26
27 This call is mostly for the i386 architecture. On many other architec‐
28 tures it does not exist or will always return an error.
29
31 On success, zero is returned. On error, -1 is returned, and errno is
32 set appropriately.
33
35 EINVAL Invalid values for from or num.
36
37 EIO (on PowerPC) This call is not supported.
38
39 ENOMEM Out of memory.
40
41 EPERM The calling process has insufficient privilege.
42
44 ioperm() is Linux-specific and should not be used in programs intended
45 to be portable.
46
48 Libc5 treats it as a system call and has a prototype in <unistd.h>.
49 Glibc1 does not have a prototype. Glibc2 has a prototype both in
50 <sys/io.h> and in <sys/perm.h>. Avoid the latter, it is available on
51 i386 only.
52
54 iopl(2), capabilities(7)
55
57 This page is part of release 3.22 of the Linux man-pages project. A
58 description of the project, and information about reporting bugs, can
59 be found at http://www.kernel.org/doc/man-pages/.
60
61
62
63Linux 2007-06-15 IOPERM(2)