Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

i386_get_ioperm(2) [freebsd man page]

I386_GET_IOPERM(2)					      BSD System Calls Manual						I386_GET_IOPERM(2)

NAME
i386_get_ioperm, i386_set_ioperm -- manage per-process access to the i386 I/O port space LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <machine/sysarch.h> int i386_get_ioperm(unsigned int start, unsigned int *length, int *enable); int i386_set_ioperm(unsigned int start, unsigned int length, int enable); DESCRIPTION
The i386_get_ioperm() system call will return the permission for the process' I/O port space in the *enable argument. The port range starts at start and the number of contiguous entries will be returned in *length. The i386_set_ioperm() system call will set access to a range of I/O ports described by the start and length arguments to the state specified by the enable argument. RETURN VALUES
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The i386_get_ioperm() and i386_set_ioperm() system calls will fail if: [EINVAL] An invalid range was specified by the start or length arguments. [EPERM] The caller of i386_set_ioperm was not the superuser. SEE ALSO
io(4) AUTHORS
This man page was written by Jonathan Lemon. BSD
July 27, 1998 BSD

Check Out this Related Man Page

IO(4)							   BSD Kernel Interfaces Manual 						     IO(4)

NAME
io -- I/O privilege file SYNOPSIS
device io #include <sys/types.h> #include <sys/ioctl.h> #include <dev/io/iodev.h> #include <machine/iodev.h> struct iodev_pio_req { u_int access; u_int port; u_int width; u_int val; }; DESCRIPTION
The special file /dev/io is a controlled security hole that allows a process to gain I/O privileges (which are normally reserved for kernel- internal code). This can be useful in order to write userland programs that handle some hardware directly. The usual operations on the device are to open it via the open(2) interface and to send I/O requests to the file descriptor using the ioctl(2) syscall. The ioctl(2) requests available for /dev/io are mostly platform dependent, but there are also some in common between all of them. The IODEV_PIO is used by all the architectures in order to request that an I/O operation be performed. It takes a 'struct iodev_pio_req' argu- ment that must be previously setup. The access member specifies the type of operation requested. It may be: IODEV_PIO_READ The operation is an "in" type. A value will be read from the specified port (retrieved from the port member) and the result will be stored in the val member. IODEV_PIO_WRITE The operation is a "out" type. The value will be fetched from the val member and will be written out to the specified port (defined as the port member). Finally, the width member specifies the size of the operand to be read/written, expressed in bytes. In addition to any file access permissions on /dev/io, the kernel enforces that only the super-user may open this device. LEGACY
The /dev/io interface used to be very i386 specific and worked differently. The initial implementation simply raised the IOPL of the current thread when open(2) was called on the device. This behaviour is retained in the current implementation as legacy support for both i386 and amd64 architectures. SEE ALSO
close(2), i386_get_ioperm(2), i386_set_ioperm(2), ioctl(2), open(2), mem(4) HISTORY
The io file appeared in FreeBSD 1.0. BSD
June 01, 2010 BSD
Man Page