how can I get filename from file descriptor?

John F. Haugh II jfh at rpp386.cactus.org
Sun Oct 8 00:28:33 AEST 1989


In article <947 at cirrusl.UUCP> dhesi%cirrusl at oliveb.ATC.olivetti.com (Rahul Dhesi) writes:
>In article <1189 at necisa.ho.necisa.oz> boyd at necisa.ho.necisa.oz (Boyd Roberts)
>writes:
>>There is no EOF in UNIX; ...
>>...A suitable stream line discipline would solve 
>>whatever your problem is.
>
>There *is* an EOF in UNIX.  Enough UNIX documentation says it that I
>believe it.  Case closed.

The only EOF UNIX has this lifetime is zero-length-read.  Until
you change your name to Ken Thompson, asserting UNIX needs a new
EOF mechanism is only going to draw stares.

The zero-length convention works -very- nicely compared to others
I've had the misfortune to use.  In particular, I'm much more fond
of 'while (read (...) > 0)' over Pascals 'while not eof (hi_mom) ...'

>The zero-length read/write strategy, besides not working for pipes,
>also doesn't work with buffered streams.  It's a pretty poor solution
>at this time.

Actually I think it's the best solution any has ever dreamt up.
The only objects which I am aware of supporting multiple EOFs are
tape devices [ and terminals, but more on that some other day ... ]

The zero-length-read paradigm has a very intuitve meaning.  It
means there is nothing left to read ...
-- 
John F. Haugh II                        +-Things you didn't want to know:------
VoiceNet: (512) 832-8832   Data: -8835  | The real meaning of MACH is ...
InterNet: jfh at rpp386.cactus.org         |    ... Messages Are Crufty Hacks.
UUCPNet:  {texbell|bigtex}!rpp386!jfh   +--------------------------------------



More information about the Comp.unix.wizards mailing list