NAME |LIBRARY |SYNOPSIS |DESCRIPTION |VERSIONS |STANDARDS |SEE ALSO |COLOPHON | |
outb(2) System Calls Manualoutb(2)outb, outw, outl, outsb, outsw, outsl, inb, inw, inl, insb, insw, insl, outb_p, outw_p, outl_p, inb_p, inw_p, inl_p - port I/O
Standard C library (libc,-lc)
#include <sys/io.h>unsigned char inb(unsigned shortport);unsigned char inb_p(unsigned shortport);unsigned short inw(unsigned shortport);unsigned short inw_p(unsigned shortport);unsigned int inl(unsigned shortport);unsigned int inl_p(unsigned shortport);void outb(unsigned charvalue, unsigned shortport);void outb_p(unsigned charvalue, unsigned shortport);void outw(unsigned shortvalue, unsigned shortport);void outw_p(unsigned shortvalue, unsigned shortport);void outl(unsigned intvalue, unsigned shortport);void outl_p(unsigned intvalue, unsigned shortport);void insb(unsigned long count;unsigned shortport, voidaddr[count],unsigned longcount);void insw(unsigned long count;unsigned shortport, voidaddr[count],unsigned longcount);void insl(unsigned long count;unsigned shortport, voidaddr[count],unsigned longcount);void outsb(unsigned long count;unsigned shortport, const voidaddr[count],unsigned longcount);void outsw(unsigned long count;unsigned shortport, const voidaddr[count],unsigned longcount);void outsl(unsigned long count;unsigned shortport, const voidaddr[count],unsigned longcount);
This family of functions is used to do low-level port input and output. The out* functions do port output, the in* functions do port input; the b-suffix functions are byte-width and the w-suffix functions word-width; the _p-suffix functions pause until the I/O completes. They are primarily designed for internal kernel use, but can be used from user space. You must compile with-Oor-O2or similar. The functions are defined as inline macros, and will not be substituted in without optimization enabled, causing unresolved references at link time. You useioperm(2) or alternativelyiopl(2) to tell the kernel to allow the user space application to access the I/O ports in question. Failure to do this will cause the application to receive a segmentation fault.
outb() and friends are hardware-specific. Thevalue argument is passed first and theport argument is passed second, which is the opposite order from most DOS implementations.
None.
ioperm(2),iopl(2)
This page is part of theman-pages (Linux kernel and C library user-space interface documentation) project. Information about the project can be found at ⟨https://www.kernel.org/doc/man-pages/⟩. If you have a bug report for this manual page, see ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩. This page was obtained from the tarball man-pages-6.15.tar.gz fetched from ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on 2025-08-11. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgLinux man-pages 6.15 2025-06-28outb(2)Pages that refer to this page:ioperm(2), iopl(2)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |