/dev/tty implemented as /dev/fd/3

Arnold Robbins arnold%audiofax.com at mathcs.emory.edu
Thu Nov 1 04:22:38 AEST 1990


Submitted-by: arnold%audiofax.com at mathcs.emory.edu (Arnold Robbins)

In article <14162 at cs.utexas.edu> ske at pkmab.se (Kristoffer Eriksson) writes:
>If you have a program that closes only fd 3, this implementation will behave
>differently from the old /dev/tty device implementation, won't it? You will
>not be able to reach the controlling terminal by a guaranteed route, in spite
>of the fact that it is still available on other fd-s.

This is correct.  It's mostly irrelevant though; in current Unix systems if
you do the right magic you can't get use /dev/tty even though the terminal is
still available on the currently open file descriptors.  Six of one, a
half-dozen of the other, as they say.

>Or is the controlling
>terminal concept implemented in such a way that closing fd 3 is the same as
>disassociating from the controlling terminal (so you won't be bother with
>terminal interrupts and such) ?

I don't think this is the case.  V10 still has the concept of a "controlling
terminal", but I strongly doubt that the kernel knows it's on fd 3.  However,
the controlling terminal isn't as pervasive a concept in Research Unix as it
is in BSD or System V.  (In BSD, if you disassociate yourself from the
controlling terminal, and then open some random /dev/tty<whatever>, it
automatically becomes your controlling terminal.  In V10 you'd have to
explicitly make that happen.)

Let me make a clarifying statement.  There are two things under discussion.
1) the usefulness of /dev/fd, 2) the usefulness of having /dev/tty be
/dev/fd/3.   Everyone who's actually used /dev/fd feels it's useful, so
we can take point 1) as a given for a nice feature.  Point 2) has its
plusses and minuses, but, IMO, the minuses don't outweigh the plusses.
Also, if it's good enough for Dennis Ritchie, it's probably good enough
for me. :-)
-- 
Arnold Robbins				AudioFAX, Inc. | Laundry increases
2000 Powers Ferry Road, #200 / Marietta, GA. 30067     | exponentially in the
INTERNET: arnold at audiofax.com Phone:   +1 404 933 7612 | number of children.
UUCP:	  emory!audfax!arnold Fax-box: +1 404 618 4581 |   -- Miriam Robbins

Volume-Number: Volume 22, Number 18



More information about the Comp.std.unix mailing list