I looked through the later Editions. 9th is the same as 8th.

In the 10th edition the hack is replaced by an equally small, slightly naughty, but otherwise normal device driver:
https://minnie.tuhs.org/cgi-bin/utree.pl?file=V10/sys/io/fd.c

This approach, too, would have worked as early as 4th edition.

On Apr 20, 2020, at 5:16 PM, arnold@skeeve.com wrote:

Glad to have helped. Maybe later systems did the symlink.  I'm pretty sure SVR4 and later Linux did
it with symlinks.

SVR4 went overboard - /dev/fd was a separate file system type!

Arnold

Paul Ruizendaal <pnr@planet.nl> wrote:

Thanks for that!

Indeed they are on the /dev/fd man page of 8th Edition.

I’m thrilled that https://unix50.org is back up and could quickly check. They are not symlinks, but character special files (with the same major/minor, of course). In the /dev/fd directory all 128 possible device entries were added.

It certainly suggests that a virtual /dev directory (like /proc) would have been useful.

Who added this neat little innovation?

Googling for /dev/fd also answered my other question: http://poincare.matf.bg.ac.rs/~ivana/courses/ps/sistemi_knjige/pomocno/apue/APUE/0201433079/ch03lev1sec16.html

"The /dev/fd feature was developed by Tom Duff and appeared in the 8th Edition of the Research UNIX System.”



On 20 Apr 2020, at 16:28, arnold@skeeve.com wrote:

See if there are man pages for /dev/fd/XXX.  IIRC /dev/stdin was
a symlink to /dev/fd/0, /dev/stdout to /dev/fd/1, /dev/stderr to /dev/fd/2,
and, as a really nice generalization, /dev/tty to /dev/fd/4.  For the
latter, init(1) simply dup'ed the opened tty file descriptor one more
time before exec-ing login.

HTH,

Arnold

Paul Ruizendaal <pnr@planet.nl> wrote:

Whilst spelunking in the V8 source code I came across this dozen lines:
http://chiselapp.com/user/pnr/repository/v8unix/artifact/2782d26fa2930724?ln=174,187

It implements the /dev/stdin, /dev/stdout and /dev/stderr devices (the variable ‘file_no’ in above code snippet is the constant 40, which is the major number of these devices). It would seem that this handful of lines could have been in Unix as early as 4th Edition — but they weren’t. Maybe it was not seen as useful.

As far as I can tell this bit of code originates in 8th Edition, with no earlier precursors. It does not seem to be in its man pages.

Who added this neat little innovation?