Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

io(4) [netbsd 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

Check Out this Related Man Page

SNP(4)                                                     BSD Kernel Interfaces Manual                                                     SNP(4)

NAME
snp -- tty snoop interface SYNOPSIS
#include <sys/snoop.h> int ioctl(fd, SNPSTTY, &dev); int ioctl(fd, SNPGTTY, &dev); int ioctl(fd, FIONREAD, &result); DESCRIPTION
/dev/snp is a snoop device which allows users to attach to any tty and watch activities on it. The kernel must be compiled with device snp, or the snp module must be loaded, for these devices to be available. To associate a given snp device with a tty to be observed, open the snp device and a tty device, and then issue the SNPSTTY ioctl on snp device. The argument passed to the ioctl(2) is the address of a variable of type int, holding the file descriptor of a tty device. To detach the snp device from a tty use a pointer to a value of -1. The SNPGTTY ioctl returns information about the current tty attached to the open snp device. The FIONREAD ioctl returns a positive value equal to the number of characters in a read buffer. Special values defined are: SNP_OFLOW device overflow occurred, device detached. SNP_TTYCLOSE tty not attached. SNP_DETACH snp device has been detached by user or tty device has been closed and detached. SEE ALSO
pty(4), sio(4), kldload(8), watch(8) HISTORY
The snp device first appeared in FreeBSD 2.1. In FreeBSD 8.0 the snp driver was rewritten to work with the replaced TTY subsystem. AUTHORS
The author of the current implementation is Ed Schouten <ed@FreeBSD.org>. Previous versions of snp were based on code written by Ugen J.S. Antsilevich <ugen@NetVision.net.il>. BUGS
This version of snp does not return proper error codes when calling FIONREAD. It also does not allow SNPSTTY to detach itself from the TTY. BSD November 5, 2008 BSD
Man Page