Device files show up in long listings with two numbers where the size would ordinarily be:
crw-rw-rw- 1 root wheel 1, 0 Jan 3 11:29 /dev/tty crw--w---- 1 pcunix tty 5, 0 Jan 5 16:53 /dev/ttyp0 crw-rw-rw- 1 root wheel 5, 1 Jan 3 12:48 /dev/ttyp1 crw-rw-rw- 1 root wheel 5, 2 Jan 3 13:15 /dev/ttyp2
The first number is the major number for the device, and actually is simply an index into a table of memory addresses in your kernel. When you attempt to open /dev/tty, the kernel calls the code referenced by position one in its index. The second number (the minor number) is passed to that code as an argument.
The significance of the minor number is up to the code in the device driver. In the case of the ttyp* devices above, it is used to select which pseudo tty is being used. For a tape drive, it might indicate whether or not to rewind the tape before doing i/o.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-07-05 Tony Lawrence
May you live long enough to regret your opinions - (Tony Lawrence)
Printer Friendly Version
number Copyright © January 2004 Tony Lawrence
Have you tried Searching this site?
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.
Contact us
Printer Friendly Version