APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2004/01/07 minor number

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.




Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence



Kerio Samepage


Have you tried Searching this site?

Support Rates

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





That's the thing about people who think they hate computers. What they really hate is lousy programmers. (Larry Niven)





This post tagged: