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?
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?
>
>
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? >> >>
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?
> >>
> >>
>
[-- Attachment #1: Type: text/plain, Size: 2697 bytes --] 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 <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? >>>> >>>> >> [-- Attachment #2: Type: text/html, Size: 4315 bytes --]
On Mon, Apr 20, 2020 at 08:28:53AM -0600, 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.
So what happened to /dev/fd/3 ?
DF
Derek Fawcus <dfawcus+lists-tuhs@employees.org> wrote:
> On Mon, Apr 20, 2020 at 08:28:53AM -0600, 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.
>
> So what happened to /dev/fd/3 ?
>
> DF
My bad. I meant /dev/fd/3. What was cute was that /dev/tty was
no longer a special device of it's own, but just another inherited
open file descriptor.
Sadly, that generalization never made it out into other *nix systems.
Arnold
[-- Attachment #1: Type: text/plain, Size: 1046 bytes --] I think dmr put them in, at my suggestion. I was bothered by the inconsistent use of '-' as a name for standard input. Giving stdin a real name meant we had a consistent mechanism. 8th edition sounds right. -rob On Tue, Apr 21, 2020 at 4:33 AM <arnold@skeeve.com> wrote: > Derek Fawcus <dfawcus+lists-tuhs@employees.org> wrote: > > > On Mon, Apr 20, 2020 at 08:28:53AM -0600, 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. > > > > So what happened to /dev/fd/3 ? > > > > DF > > My bad. I meant /dev/fd/3. What was cute was that /dev/tty was > no longer a special device of it's own, but just another inherited > open file descriptor. > > Sadly, that generalization never made it out into other *nix systems. > > Arnold > [-- Attachment #2: Type: text/html, Size: 1649 bytes --]
Other mail in the thread credits Tom Duff with /dev/fd ... In any case,
/dev/stdin et al was a great idea.
Kudos.
Arnold
Rob Pike <robpike@gmail.com> wrote:
> I think dmr put them in, at my suggestion. I was bothered by the
> inconsistent use of '-' as a name for standard input. Giving stdin a real
> name meant we had a consistent mechanism.
>
> 8th edition sounds right.
>
> -rob
>
>
> On Tue, Apr 21, 2020 at 4:33 AM <arnold@skeeve.com> wrote:
>
> > Derek Fawcus <dfawcus+lists-tuhs@employees.org> wrote:
> >
> > > On Mon, Apr 20, 2020 at 08:28:53AM -0600, 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.
> > >
> > > So what happened to /dev/fd/3 ?
> > >
> > > DF
> >
> > My bad. I meant /dev/fd/3. What was cute was that /dev/tty was
> > no longer a special device of it's own, but just another inherited
> > open file descriptor.
> >
> > Sadly, that generalization never made it out into other *nix systems.
> >
> > Arnold
> >
On Wed, 22 Apr 2020, arnold@skeeve.com wrote:
> Other mail in the thread credits Tom Duff with /dev/fd ... In any case,
> /dev/stdin et al was a great idea.
I make *heavy* use of /dev/stdin and /dev/stdout on Linux. Very useful
concept.
-uso.
[-- Attachment #1: Type: text/plain, Size: 433 bytes --] Not certain, but it's possible /dev/stdin went in first, and /dev/fd/* generalized it. -rob On Wed, Apr 22, 2020 at 7:35 PM Steve Nickolas <usotsuki@buric.co> wrote: > On Wed, 22 Apr 2020, arnold@skeeve.com wrote: > > > Other mail in the thread credits Tom Duff with /dev/fd ... In any case, > > /dev/stdin et al was a great idea. > > I make *heavy* use of /dev/stdin and /dev/stdout on Linux. Very useful > concept. > > -uso. > [-- Attachment #2: Type: text/html, Size: 842 bytes --]