1ioperm(2)                     System Calls Manual                    ioperm(2)
2
3
4

NAME

6       ioperm - set port input/output permissions
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

12       #include <sys/io.h>
13
14       int ioperm(unsigned long from, unsigned long num, int turn_on);
15

DESCRIPTION

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

RETURN VALUE

36       On  success,  zero is returned.  On error, -1 is returned, and errno is
37       set to indicate the error.
38

ERRORS

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

VERSIONS

49       glibc has an ioperm() prototype both in <sys/io.h> and in <sys/perm.h>.
50       Avoid the latter, it is available on i386 only.
51

STANDARDS

53       Linux.
54

HISTORY

56       Before  Linux 2.4, permissions were not inherited by a child created by
57       fork(2).
58

NOTES

60       The /proc/ioports file shows the I/O ports that are currently allocated
61       on the system.
62

SEE ALSO

64       iopl(2), outb(2), capabilities(7)
65
66
67
68Linux man-pages 6.05              2023-03-30                         ioperm(2)
Impressum