phantom device nodes?

  • Thread starter Deleted member 54719
  • Start date
D

Deleted member 54719

Guest
I noticed something the other day when configuring the OSS sound drivers on an old Dell Inspirion Nforce MCP61 desktop machine; something that bothers my sensibilities. One of the first things I do when checking to see if a device or service is available is to look for the device entries in /dev. dmesg showed that the sound hardware was found and /dev/sndstat had two PCM devices listed in it. However, no /dev/dsp* or /dev/pcm* file nodes existed.

In my mind that would indicate that the driver, or a supplemental component is not loaded. The really weird thing is that when I did something like cat < /dev/dsp the command worked and read binary sound samples from the sound card. A subsequent ls -l /dev/dsp* showed that a device node of /dev/dsp0.0 mysteriously appeared...not even the same device name I used when reading the audio data.

In what world is it normal or acceptable to be able to read a file, for which no directory entry exists, then the system creates a similar directory entry when the device is accessed? Can someone explain the rationale or the history of why this even works? Seems to me that in any NIX trying to read from a non-existent file node should return an error, not create a similarly named entry and read from it. This is very odd behaviour to me.
 
In the early days of FreeBSD you had to actually create device nodes manually, so what you describe would have given you an error prior to FreeBSD 5.0
Take a look at the mknod(8) manpage, there is some historical explanation at the end.
Nowadays, device nodes are created on the fly by devfs. Only device nodes for devices that actually exist will be created.
I can't explain that in detail but I remember the times when they had to be created manually.
 
In the early days of FreeBSD you had to actually create device nodes manually, so what you describe would have given you an error prior to FreeBSD 5.0
Take a look at the mknod(8) manpage, there is some historical explanation at the end.
Nowadays, device nodes are created on the fly by devfs. Only device nodes for devices that actually exist will be created.
I can't explain that in detail but I remember the times when they had to be created manually.

I understand the dynamic creation aspect, but what doesn't make sense to me is the deferred creation of the device file until it is requested, and then being created with a name other than what was used. I could find nothing in applicable devfs.rules that would account for the behaviour. -- thanks for the input though
 
Back
Top