io (4)
Leading comments
Copyright (c) 1996 Joerg Wunsch All rights reserved. This program is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in ...
NAME
io - I/O privilege fileSYNOPSIS
device ioIn sys/types.h In sys/ioctl.h In dev/io/iodev.h In 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' argument that must be previously setup.
The Fa 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 Fa port member) and the result will be stored in the Fa val member.
- IODEV_PIO_WRITE
- The operation is a "out" type. The value will be fetched from the Fa val member and will be written out to the specified port (defined as the Fa port member).
Finally, the Fa 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.