sectionioctl (Devices) [7aa79a42]
- Devices are special file
/devis devices- When we need to do IO on a device, just go out and access it!
-
Block special files and character special files
ls -l->cfor character file,bfor block file-
major and minor numbers, represents type of the device, and reprsents the instance
- 4k major numbers, 2^20 minor numbers
mknodis used to make a device special file- Nothing special about these files! You can make them anywhere
-
udevis a program that sits there and creates files in the/devdirectory- devices can register themselves or get a number assigned to them
- much effort has gone into making devices work together
-
traditional device operations
open()close()read()write()seek()-
ioctl- lets you do particular things to particular device
- usually takes some integers (like everything in unix world)
-
block devices
- tend to do I/O in terms of blocks
- like disk drives
- usually more random access
- disks for example
-
character devices
- operate in bytes
- usually more seequential
- mouse/audio card/printer/tape/terminal for example