man-pages/man2/iopl.2.html
2021-03-31 01:06:50 +01:00

172 lines
4.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of IOPL</TITLE>
</HEAD><BODY>
<H1>IOPL</H1>
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
iopl - change I/O privilege level
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>#include &lt;<A HREF="file:///usr/include/sys/io.h">sys/io.h</A>&gt;</B>
<P>
<B>int iopl(int </B><I>level</I><B>);</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>iopl</B>()
changes the I/O privilege level of the calling process,
as specified by the two least significant bits in
<I>level</I>.
<P>
This call is necessary to allow 8514-compatible X servers to run under
Linux.
Since these X servers require access to all 65536 I/O ports, the
<B><A HREF="/cgi-bin/man/man2html?2+ioperm">ioperm</A></B>(2)
call is not sufficient.
<P>
In addition to granting unrestricted I/O port access, running at a higher
I/O privilege level also allows the process to disable interrupts.
This will probably crash the system, and is not recommended.
<P>
Permissions are not inherited by the child process created by
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2)
and are not preserved across
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2)
(but see NOTES).
<P>
The I/O privilege level for a normal process is 0.
<P>
This call is mostly for the i386 architecture.
On many other architectures it does not exist or will always
return an error.
<A NAME="lbAE">&nbsp;</A>
<H2>RETURN VALUE</H2>
On success, zero is returned.
On error, -1 is returned, and
<I>errno</I>
is set appropriately.
<A NAME="lbAF">&nbsp;</A>
<H2>ERRORS</H2>
<DL COMPACT>
<DT id="1"><B>EINVAL</B>
<DD>
<I>level</I>
is greater than 3.
<DT id="2"><B>ENOSYS</B>
<DD>
This call is unimplemented.
<DT id="3"><B>EPERM</B>
<DD>
The calling process has insufficient privilege to call
<B>iopl</B>();
the
<B>CAP_SYS_RAWIO</B>
capability is required to raise the I/O privilege level
above its current value.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>CONFORMING TO</H2>
<B>iopl</B>()
is Linux-specific and should not be used in programs that are
intended to be portable.
<A NAME="lbAH">&nbsp;</A>
<H2>NOTES</H2>
Glibc2 has a prototype both in
<I>&lt;<A HREF="file:///usr/include/sys/io.h">sys/io.h</A>&gt;</I>
and in
<I>&lt;<A HREF="file:///usr/include/sys/perm.h">sys/perm.h</A>&gt;</I>.
Avoid the latter, it is available on i386 only.
<P>
Prior to Linux 3.7,
on some architectures (such as i386), permissions
<I>were</I>
inherited by the child produced by
<B><A HREF="/cgi-bin/man/man2html?2+fork">fork</A></B>(2)
and were preserved across
<B><A HREF="/cgi-bin/man/man2html?2+execve">execve</A></B>(2).
This behavior was inadvertently changed in Linux 3.7,
and won't be reinstated.
<A NAME="lbAI">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?2+ioperm">ioperm</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?2+outb">outb</A></B>(2),
<B><A HREF="/cgi-bin/man/man2html?7+capabilities">capabilities</A></B>(7)
<A NAME="lbAJ">&nbsp;</A>
<H2>COLOPHON</H2>
This page is part of release 5.05 of the Linux
<I>man-pages</I>
project.
A description of the project,
information about reporting bugs,
and the latest version of this page,
can be found at
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="7"><A HREF="#lbAE">RETURN VALUE</A><DD>
<DT id="8"><A HREF="#lbAF">ERRORS</A><DD>
<DT id="9"><A HREF="#lbAG">CONFORMING TO</A><DD>
<DT id="10"><A HREF="#lbAH">NOTES</A><DD>
<DT id="11"><A HREF="#lbAI">SEE ALSO</A><DD>
<DT id="12"><A HREF="#lbAJ">COLOPHON</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:33 GMT, March 31, 2021
</BODY>
</HTML>