Subject: Re: device special files
To: Matthew Mondor <mm_lists@pulsar-zone.net>
From: Petar Bogdanovic <p+netbsd@2005.smokva.net>
List: tech-kern
Date: 11/16/2005 01:46:47
Very interesting, thank you!

Matthew Mondor wrote:
> Although both fifos and device special files can be created using mknod,
> they are different in that fifos are especially treated via the vfs layer
> to src/sys/kern/sys_pipe.c

I can't find any fifo-files in /dev. Will the kernel create a fifo-file 
only if I use a 'UNIX-pipe'? If yes - where will he create the file?


> As for the device special files, the important part is that the kernel
> deals with major/minor device descriptors,

I heard a lot about file-descriptors I my life, but device-desc. are 
pretty new to me. Is it safe to assume, that device-descriptors are an 
internal way of the kernel, to enumerate the available hardware- and 
software-devices?

But then, I ask myself another question: Why is MAKEDEV creating 1857 
files in my /dev?

For example: I don't have an usb-scanner but

starling# ls -l /dev/uscanner*
crw-------  1 root  wheel  75, 0 Oct 28 03:07 /dev/uscanner0
crw-------  1 root  wheel  75, 1 Oct 28 03:07 /dev/uscanner1


> For instance, consider /dev/random (i386):
> cr--r--r--  1 root  wheel  46, 0 Oct  5  2004 /dev/random
> 
> Character device (c), major device 46, minor device 0.  Accessing this
> file will in the kernel map the file i/o syscalls in this case to the
> code found in src/sys/dev/rnd.c

*light-goes-on* - good example!


> I hope this helps a bit,

Indeed. :)


Kind regards,

Petar