1IOPERM(2)                  Linux Programmer's Manual                 IOPERM(2)
2
3
4

NAME

6       ioperm - set port input/output permissions
7

SYNOPSIS

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

DESCRIPTION

15       ioperm()  sets  the  port access permission bits for the calling thread
16       for num bits starting from port address from.  If turn_on  is  nonzero,
17       then permission for the specified bits is enabled; otherwise it is dis‐
18       abled.  If turn_on is nonzero, the calling thread  must  be  privileged
19       (CAP_SYS_RAWIO).
20
21       Before  Linux  2.6.8, only the first 0x3ff I/O ports could be specified
22       in this manner.  For more ports, the iopl(2) system call had to be used
23       (with  a level argument of 3).  Since Linux 2.6.8, 65,536 I/O ports can
24       be specified.
25
26       Permissions are not inherited by the child created by fork(2);  follow‐
27       ing  a  fork(2) the child must turn on those permissions that it needs.
28       Permissions are preserved across execve(2); this is useful  for  giving
29       port access permissions to unprivileged programs.
30
31       This call is mostly for the i386 architecture.  On many other architec‐
32       tures it does not exist or will always return an error.
33

RETURN VALUE

35       On success, zero is returned.  On error, -1 is returned, and  errno  is
36       set appropriately.
37

ERRORS

39       EINVAL Invalid values for from or num.
40
41       EIO    (on PowerPC) This call is not supported.
42
43       ENOMEM Out of memory.
44
45       EPERM  The calling thread has insufficient privilege.
46

CONFORMING TO

48       ioperm()  is Linux-specific and should not be used in programs intended
49       to be portable.
50

NOTES

52       The /proc/ioports file shows the I/O ports that are currently allocated
53       on the system.
54
55       Libc5  treats  it  as  a system call and has a prototype in <unistd.h>.
56       Glibc1 does not have a prototype.   Glibc2  has  a  prototype  both  in
57       <sys/io.h>  and  in <sys/perm.h>.  Avoid the latter, it is available on
58       i386 only.
59

SEE ALSO

61       iopl(2), outb(2), capabilities(7)
62

COLOPHON

64       This page is part of release 3.53 of the Linux  man-pages  project.   A
65       description  of  the project, and information about reporting bugs, can
66       be found at http://www.kernel.org/doc/man-pages/.
67
68
69
70Linux                             2013-03-12                         IOPERM(2)
Impressum