[TUHS] FD 2

Warner Losh imp at bsdimp.com
Sun Jan 22 04:37:42 AEST 2023


On Sat, Jan 21, 2023, 11:26 AM Clem Cole <clemc at ccc.com> wrote:

>
>
> On Sat, Jan 21, 2023 at 12:50 PM Warner Losh <imp at bsdimp.com> wrote:
>
>
>>
>> Further digging shows v6 is quite similar.
>>
> As I said, by then they know it's an issue and the fd 2 has been
> introduced.   The place to look is not the utilities, but the shell itself
> and what the kernel is doing in newproc et al for the tty handler.
>

The utilities were all using printf so even if the concept was there, it
wasn't widely used.

I'll take a longer look, including these places..  though I'm not sure I
see the connection to the tty driver...

V7 revamps everything, with printf changed to a routine that writes to
>> stderr. Each program did this differently.
>>
> IMO: Sort of two different things >>I think<<. They are related - the idea
> ( what the OS supplied to each process), as opposed to what/how each
> utility handled it.
>

Yea. Mostly i think each program had a different wrapper around stderr to
minimize changes to the program...

With typesetter C -- we get dmr's new stdio library (libS.a) replacing
> Lesk's portable C library.  This was released independent of V6 as what DEC
> would have called a 'layered product"  that ran on top of V6.    As I said,
> this is the language that Dennis and Brian describe in K&R (version 1).
>

Do we have extant copies of that? So far I have see the kernel patches that
were "leaked" but not the rest of it.

With what was becoming UNIX/TS -- which don't seem to have a formal release
> -- we get what we all think of as the V7 kernel, Bourne's new shell and the
> new and updated tools suite as part of the system
>

Yea.

So with V7, as you point out, most, but not all of the utilities have been
> updated to start using the new compiler (since by then Lesk library is not
> included), If the code were recompiled, that code would have had to used
> the new FILE * structure over the small integer fd, for the printf family.
>  With V6 there were still a handful of utilities in assembler (like snoball
> IIRC), but by V7 I think most of them had been culled.
>
> And while your point is that you need to look at what each utility
> implemented, >>I believe<< that the key to Ron's question is what the shell
> and the kernel supplied [dates the idea], and >>then<< if the utility
> obeyed the new fd 2 as the error file is when it starts to be more formally
> enforced. So any further hunting should start there I would think.
>

Yea. Like many things, there was a transition... the most important bit is
the shell. And that was more tricky to read through with the phone at
breakfast...

Warner


Clem
>
>
>
>>
>> Granted, this is a small sample size. There wasn't a huge uptake of
>> stderr/fd2 in v6 it seems, but v7 looks like it had a pass over the code to
>> at least try for all errors going to fd2.
>>
>> Warner
>>
>>
>>> Warner
>>>
>>> On Fri, Jan 20, 2023 at 5:46 PM ron minnich <rminnich at gmail.com> wrote:
>>>>
>>>>> I am trying to remember when fd 2 (aka stderr) became a thing. I have
>>>>> a vague memory that it was post-v6 but that may be way off.
>>>>>
>>>>>
>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20230121/0c1bc424/attachment.htm>


More information about the TUHS mailing list