Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

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

PCI(3)							   BSD Library Functions Manual 						    PCI(3)

NAME
pci -- library interface for PCI bus access LIBRARY
PCI Bus Access Library (libpci, -lpci) SYNOPSIS
#include <pci.h> int pcibus_conf_read(int pcifd, u_int bus, u_int dev, u_int func, u_int reg, pcireg_t *valp); int pcibus_conf_write(int pcifd, u_int bus, u_int dev, u_int func, u_int reg, pcireg_t val); int pcidev_conf_read(int devfd, u_int reg, pcireg_t *valp); int pcidev_conf_write(int devfd, u_int reg, pcireg_t val); char * pci_findvendor(pcireg_t id_reg); void pci_devinfo(pcireg_t id_reg, pcireg_t class_reg, char *devinfo, size_t len); void pci_conf_print(int pcifd, u_int bus, u_int dev, u_int func); DESCRIPTION
The pci library provides support for accessing the PCI bus by user programs. These functions are available in the libpci library. Programs should be linked with -lpci. CONFIGURATION SPACE FUNCTIONS
The following functions are used to access PCI configuration space: pcibus_conf_read() Access the PCI configuration register reg on the device located at bus, dev, func, and place the result in *valp. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. pcibus_conf_write() Write the value specified by val into the PCI configuration register reg on the device located at bus, dev, func. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. pcidev_conf_read() Access the PCI configuration register reg on the device associated with the open file descriptor devfd and place the result in *valp. pcidev_conf_write() Write the value specified by val into the PCI configuration register reg on the device associated with the open file descriptor devfd. MISCELLANEOUS FUNCTIONS
The following miscellaneous functions are available: pci_findvendor() Return an ASCII description of the PCI vendor in the PCI ID register id_reg. pci_devinfo() Return an ASCII description of the PCI vendor, PCI product, and PCI class specified by the PCI ID register id_reg and PCI class ID reg- ister class_reg. The description is placed into the buffer pointed to by devinfo; the size of that buffer is specified in len. pci_conf_print() Print the PCI configuration information for the device located at bus, dev, func. pcifd must be an open file descriptor to a PCI bus within the target PCI domain. RETURN VALUES
The pcibus_conf_read(), pcibus_conf_write(), pcidev_conf_read(), and pcidev_conf_write() functions return 0 on success and -1 on failure. The pci_findvendor() function returns NULL if the PCI vendor description cannot be found. SEE ALSO
pci(4) HISTORY
The pcibus_conf_read(), pcibus_conf_write(), pcidev_conf_read(), pcidev_conf_write(), pci_findvendor(), pci_devinfo(), and pci_conf_print() functions first appeared in NetBSD 1.6. BSD
April 24, 2004 BSD
Man Page