Subject: Re: fdesc file system?
To: None <netbsd-users@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: netbsd-users
Date: 11/23/2005 14:47:22
In article <20051123000650.GB8049@sci.monash.edu.au>,
Malcolm Herbert  <mjch@mjch.net> wrote:
>I'm curious about the fdesc filesystem, which creates files in /dev/fd
>as well as symlinks for /dev/std{in,out,err}. I have a 2.0.2 system
>which appears to have /dev/std* and a populated /dev/fd yet I don't
>think I've ever tried to mount the fdesc filesystem over /dev
>
>MAKEDEV seems to create these entries if fdesc isn't mounted ... given
>that that's the case, why would we need the filesystem type? What does
>it provide that character-special files in a simple directory structure
>doesn't?

/dev/fd is populated with the real file descriptors not the driver provided
ones. I.e. if you don't mount fdesc, you always see file descriptors 1..63
which have been created by MAKEDEV; if you mount it, then you only see the
file descriptors the process is really using, including ones > 63. Another
(imho better) view of this is /proc/<pid>/fd/ which can even be used to
re-link unlinked files that a process owns.

christos