Re: The guts of /dev/* ?
From: Bill Unruh (unruh_at_string.physics.ubc.ca)
Date: 12/05/04
- Next message: Greg Lee: "Re: lilo on raid5 root doesn't work"
- Previous message: Greg Lee: "Re: lilo on raid5 root doesn't work"
- In reply to: Robert Heller: "Re: The guts of /dev/* ?"
- Next in thread: Jean-David Beyer: "Re: The guts of /dev/* ?"
- Reply: Jean-David Beyer: "Re: The guts of /dev/* ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 5 Dec 2004 00:22:52 GMT
Robert Heller <heller@deepsoft.com> writes:
] 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.
Read the source code. I highly doubt that this is what you want.
The files in /dev/are links to the device drivers. The input and output
depend on what the specific device driver will do.
cat /dev/dsp reads from teh oss audio device, and pushes the stuff out on
stdout.
Exactly what is read depends on how the device driver happens to have been
set by the ioctls for that device. (ioctls are commands sent to the device
driver with routines which deliver the ioctl codes to the driver).
]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.
]
- Next message: Greg Lee: "Re: lilo on raid5 root doesn't work"
- Previous message: Greg Lee: "Re: lilo on raid5 root doesn't work"
- In reply to: Robert Heller: "Re: The guts of /dev/* ?"
- Next in thread: Jean-David Beyer: "Re: The guts of /dev/* ?"
- Reply: Jean-David Beyer: "Re: The guts of /dev/* ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|