DevFS
The /dev file system is a special file system giving access to device drivers as files. Devices are statically registered by a device structure containing function pointers for open, read, write, close and ioctl as well as the name for use in /dev. User software may then gain access by opening that file.
Drivers must be accessed by first opening the corresponding file. For instance, use
int fb = open ("/dev/fbcon", O_RDWR);
to open the LCD framebuffer console driver. The file descriptor (here fd
)
must be closed when the driver is not needed anymore. If the program terminates
without closing it first the kernel will close it instead. It is recommended
to keep the file descriptor open while the program has use for it, and not
re-open on every use.
The device file system is read-only and does not support directories. Read, write and sharing abilities of the drivers themselves are up to the implementation of the drivers themselves.
See the entries under "Drivers" on the main page for information on how to use the drivers themselves.