The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] 8th Edition and /dev/stdio
@ 2020-04-20 13:59 Paul Ruizendaal
  2020-04-20 14:28 ` arnold
  0 siblings, 1 reply; 11+ messages in thread
From: Paul Ruizendaal @ 2020-04-20 13:59 UTC (permalink / raw)
  To: TUHS main list

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?



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-20 13:59 [TUHS] 8th Edition and /dev/stdio Paul Ruizendaal
@ 2020-04-20 14:28 ` arnold
  2020-04-20 15:01   ` Paul Ruizendaal
  2020-04-20 18:17   ` Derek Fawcus
  0 siblings, 2 replies; 11+ messages in thread
From: arnold @ 2020-04-20 14:28 UTC (permalink / raw)
  To: tuhs, pnr

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-20 14:28 ` arnold
@ 2020-04-20 15:01   ` Paul Ruizendaal
  2020-04-20 15:16     ` arnold
  2020-04-20 18:17   ` Derek Fawcus
  1 sibling, 1 reply; 11+ messages in thread
From: Paul Ruizendaal @ 2020-04-20 15:01 UTC (permalink / raw)
  To: arnold; +Cc: TUHS main list

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-20 15:01   ` Paul Ruizendaal
@ 2020-04-20 15:16     ` arnold
  2020-04-20 17:58       ` Paul Ruizendaal
  0 siblings, 1 reply; 11+ messages in thread
From: arnold @ 2020-04-20 15:16 UTC (permalink / raw)
  To: pnr, arnold; +Cc: tuhs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-20 15:16     ` arnold
@ 2020-04-20 17:58       ` Paul Ruizendaal
  0 siblings, 0 replies; 11+ messages in thread
From: Paul Ruizendaal @ 2020-04-20 17:58 UTC (permalink / raw)
  To: arnold; +Cc: tuhs

[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-20 14:28 ` arnold
  2020-04-20 15:01   ` Paul Ruizendaal
@ 2020-04-20 18:17   ` Derek Fawcus
  2020-04-20 18:32     ` arnold
  1 sibling, 1 reply; 11+ messages in thread
From: Derek Fawcus @ 2020-04-20 18:17 UTC (permalink / raw)
  To: tuhs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-20 18:17   ` Derek Fawcus
@ 2020-04-20 18:32     ` arnold
  2020-04-22  9:21       ` Rob Pike
  0 siblings, 1 reply; 11+ messages in thread
From: arnold @ 2020-04-20 18:32 UTC (permalink / raw)
  To: tuhs, dfawcus+lists-tuhs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-20 18:32     ` arnold
@ 2020-04-22  9:21       ` Rob Pike
  2020-04-22  9:33         ` arnold
  0 siblings, 1 reply; 11+ messages in thread
From: Rob Pike @ 2020-04-22  9:21 UTC (permalink / raw)
  To: Aharon Robbins; +Cc: TUHS main list

[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-22  9:21       ` Rob Pike
@ 2020-04-22  9:33         ` arnold
  2020-04-22  9:35           ` Steve Nickolas
  0 siblings, 1 reply; 11+ messages in thread
From: arnold @ 2020-04-22  9:33 UTC (permalink / raw)
  To: robpike, arnold; +Cc: tuhs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-22  9:33         ` arnold
@ 2020-04-22  9:35           ` Steve Nickolas
  2020-04-22  9:41             ` Rob Pike
  0 siblings, 1 reply; 11+ messages in thread
From: Steve Nickolas @ 2020-04-22  9:35 UTC (permalink / raw)
  To: arnold; +Cc: tuhs

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.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [TUHS] 8th Edition and /dev/stdio
  2020-04-22  9:35           ` Steve Nickolas
@ 2020-04-22  9:41             ` Rob Pike
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Pike @ 2020-04-22  9:41 UTC (permalink / raw)
  To: Steve Nickolas; +Cc: TUHS main list

[-- 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 --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-04-22  9:42 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20 13:59 [TUHS] 8th Edition and /dev/stdio Paul Ruizendaal
2020-04-20 14:28 ` arnold
2020-04-20 15:01   ` Paul Ruizendaal
2020-04-20 15:16     ` arnold
2020-04-20 17:58       ` Paul Ruizendaal
2020-04-20 18:17   ` Derek Fawcus
2020-04-20 18:32     ` arnold
2020-04-22  9:21       ` Rob Pike
2020-04-22  9:33         ` arnold
2020-04-22  9:35           ` Steve Nickolas
2020-04-22  9:41             ` Rob Pike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).