File system name space

Alain Williams addw at phcomp.co.uk
Thu Oct 25 20:48:45 AEST 1990


Submitted-by: addw at phcomp.co.uk (Alain Williams)

> Anyway, since we're discussing what is and isn't in the POSIX name space,
> I'd like to put in a plug for the /dev/fd directory.  Opening /dev/fd/7 is
> equivalent to doing a dup(7); it is a generalization of the "treat '-' as
What happens if you do an ``ls -l'' on /dev/fd, do you see the fds which are
open to the ls program or all possible fds, even those which aren't opened ?

> (In fact, in V8 - V10, /dev/stdin, /dev/stdout, /dev/stderr, and /dev/tty are
> links to /dev/fd/0, /dev/fd/1, /dev/fd/2, and /dev/fd/3, respectively.  The
> last, in particular, is a nice generalization, and eliminates an ugly special
> case in the kernel; init just does one more dup.)
I always thought that /dev/tty was a means of getting hold of the tty when
you couldn't be certain that 0,1,2 was connected to it. What you are really
saying is that the UNIX convention of 0,1,2 having ``pre defined uses'' be
extended to `3 always connected to the terminal and used for nothing else'.
It isn't a /dev/fd issue, it is a UNIX convention issue.
The other thing is the /dev/tty is a guaranteed way of getting the terminal
& not something else (that is why the passwd program uses /dev/tty).

Alain Williams

+44 734 461232

phLOGIN our Turnkey Security Login utility is available NOW - ask me for info.

Volume-Number: Volume 22, Number 5



More information about the Comp.std.unix mailing list