Re: The guts of /dev/* ?
From: Robert Heller (heller_at_deepsoft.com)
Date: 12/05/04
- Next message: Robert Heller: "Re: lilo on raid5 root doesn't work"
- Previous message: Bill Unruh: "Re: Setting date as filename with logrotate"
- In reply to: not_at_top-post: "The guts of /dev/* ?"
- Next in thread: Bill Unruh: "Re: The guts of /dev/* ?"
- Reply: Bill Unruh: "Re: The guts of /dev/* ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 05 Dec 2004 00:51:53 +0100
not@top-post,
In a message on Sat, 04 Dec 2004 10:54:05 -0600, wrote :
n> Where would I find text explaining the 'innards' of /dev/* ?
n> Not at a 'salesClerk level': "try xyz [it worked for me]. ", but
n> down at asm, interrupts ...etc. level.
n>
n> Like what happens when you cat /dev/dsp > fileName
n> - in depth.
First of all, 'device files' (eg most of the files in /dev) are not
regular files. All they do is provide a mapping from names (/dev/dsp)
to major and minor numbers (14,3). Generally the major number maps to
a device driver (source code lives in
/usr/src/linux<mumble>/drivers/...). The minor number is used to select
an 'instance' or 'aspect' of the device, where there might be more than
one instance or aspect of a given device on your system (eg multiple disk
drives/partitions, or multiple serial ports, etc.). For example, 14
relates to the sound driver. The minor numbers refer to various sound
card sub-systems:
dir -l /dev/|grep '14,'
crw------- 1 heller root 14, 4 Apr 11 2002 audio
crw------- 1 heller root 14, 20 Apr 11 2002 audio1
crw------- 1 heller root 14, 7 Apr 11 2002 audioctl
crw------- 1 heller root 14, 3 Apr 11 2002 dsp
crw------- 1 heller root 14, 19 Apr 11 2002 dsp1
crw------- 1 heller root 14, 2 Apr 11 2002 midi00
crw------- 1 heller root 14, 18 Apr 11 2002 midi01
crw------- 1 heller root 14, 34 Apr 11 2002 midi02
crw------- 1 heller root 14, 50 Apr 11 2002 midi03
crw------- 1 heller root 14, 0 Apr 11 2002 mixer
crw------- 1 heller root 14, 16 Apr 11 2002 mixer1
crw------- 1 heller root 14, 1 Apr 11 2002 sequencer
crw------- 1 root root 14, 8 Apr 11 2002 sequencer2
crw------- 1 root root 14, 6 Apr 11 2002 sndstat
There is a master table in the kernel which maps device numbers to
device driver entry points. When a device file is open()'ed, this
table is refereed to and the kernel creates a (kernel) data structure
(associated with the process) with the information needed to deal with
the device. This structure is referenced (indexed) by the file
descriptor number open returns.
For a more in-depth look, you can look at the kernel source code.
n>
n> Thanks for any info.
n>
n> == Chris Glur.
n>
n>
n>
\/
Robert Heller ||InterNet: heller@cs.umass.edu
http://vis-www.cs.umass.edu/~heller || heller@deepsoft.com
http://www.deepsoft.com /\FidoNet: 1:321/153
- Next message: Robert Heller: "Re: lilo on raid5 root doesn't work"
- Previous message: Bill Unruh: "Re: Setting date as filename with logrotate"
- In reply to: not_at_top-post: "The guts of /dev/* ?"
- Next in thread: Bill Unruh: "Re: The guts of /dev/* ?"
- Reply: Bill Unruh: "Re: The guts of /dev/* ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|