ioperm(2)
๐ ioperm(2) โ set I/O port permissions ๐
okay bestie, welcome to the ioperm page from the System Calls Manual ๐ this one's short and sweet, let's get into it ๐
๐ LIBRARY
Standard C library (libc, -lc) ๐ซถ
โจ SYNOPSIS
#include <sys/io.h>
int ioperm(unsigned long from, unsigned long num, int turn_on);
๐ธ DESCRIPTION
so basically, ioperm() sets the calling thread's access permission for num ports, starting from port address from ๐ฆ
if turn_on is nonzero, permission for those ports gets turned on; otherwise it gets turned off. and here's the tea: if turn_on is nonzero, the calling thread must be privileged โ like, it needs CAP_SYS_RAWIO ๐
okay now the lore: before Linux 2.6.8, only the first 0x3ff I/O ports could be specified this way. wanted more? you had to use the iopl(2) system call instead, with a level argument of 3 ๐ญ since Linux 2.6.8, 65,536 I/O ports can be specified. we love growth ๐
permissions are inherited by the child created by fork(2) โ but peek at HISTORY for the plot twist ๐ permissions are preserved across execve(2), which is lowkey the whole point: it's useful for giving port access permissions to unprivileged programs โจ
this call is mostly for the i386 architecture. on many other architectures it does not exist, or it will always return an error ๐
๐ฅ RETURN VALUE
win? you get zero ๐ lose? you get -1 back, and errno is set to tell you what went wrong ๐
๐ ERRORS
EINVALโ invalid values forfromornum๐EIOโ (on PowerPC) this call is not supported, sorry bestie ๐ญENOMEMโ out of memory ๐ตEPERMโ the calling thread has insufficient privilege ๐๐ซ
โญ VERSIONS
glibc has an ioperm() prototype in both <sys/io.h> and <sys/perm.h>. avoid the latter โ it is available on i386 only ๐ฉ
๐ STANDARDS
Linux โจ
๐ฐ๏ธ HISTORY
before Linux 2.4, permissions were not inherited by a child created by fork(2). wild, right? ๐ณ
๐ง NOTES
the /proc/ioports file shows the I/O ports that are currently allocated on the system ๐ handy!!
๐ SEE ALSO
iopl(2), outb(2), capabilities(7)
and that's the whole page, no cap ๐ go forth and permission responsibly bestie ๐ซถ
okay love u bye โ this was pulled from Linux man-pages 6.20, dated 2026-10-11 ๐๐โจ
๐ฆ where this page comes from
- arch rolling: man-pages 6.20-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- ๐ the page's license: GPL-2.0-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms