Subject: Re: device special files
To: None <tech-kern@netbsd.org>
From: Matthew Mondor <mm_lists@pulsar-zone.net>
List: tech-kern
Date: 11/15/2005 20:50:37
On Wed, 16 Nov 2005 01:46:47 +0100
Petar Bogdanovic <p+netbsd@2005.smokva.net> wrote:

> 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?

En enumeration of userspace <-> kernelspace device identifiers yes

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

They are only created as a convenience in case you have such a device.
Trying to use such an unexisting device will result in "device not
configured" errors.  If we had a devfs, a virtual fs somewhat like /kern
and /proc, it would be possible to have them magically appear only for
configured devices;  However since we are currently using a
general-purpose filesystem to store device files, the MAKEDEV script is
generally used by default and just populates /dev with any that has may
have potential use.

Note that under a chroot(2) setup, /dev is often much smaller and
typically only has /dev/null and other necessary device files strictly
used by the application ran under the new root environment.  For uses
such as these, even if we had a devfs the traditional method would still
find its place.

If you are interested in knowing more about BSD/unix internals, there
are a number of documentation sources you could find, this mailing
list's archive for instance often had threads on the subject, such as
"BSD kernel books recommendation" and "Learning the kernel" threads in
2004 which are pointing to many good references...

Matt

--- 
Note: Please only reply on the list, other mail is blocked by default.
Private messages from your address can be allowed by first asking.