how can I get filename from file descriptor?

Boyd Roberts boyd at necisa.ho.necisa.oz
Fri Sep 29 10:38:17 AEST 1989


In article <867 at cirrusl.UUCP> dhesi%cirrusl at oliveb.ATC.olivetti.com (Rahul Dhesi) writes:
>... Unfortunately this mechanism is not general enough,
>so a process writing to a pipe has no way of communicating the same
>thing that a user at a tty can communicate by typing the EOF
>character.
>

This is the old poor person's approach to IPC scenario.

There is no EOF in UNIX; read() returns 0 when there's nothing more to read.
Certain devices are able to return multiple read() 0 returns (ie. ttys), but
the situation is that when read() returns 0 THERE IS NO MORE DATA TO BE READ.

You are trying to avoid implementing a protocol that would provide the
_correct_ solution.  A suitable stream line discipline would solve 
whatever your problem is.

As someone once said:

    `Don't diddle the code, choose a better algorithm'


Boyd Roberts			boyd at necisa.ho.necisa.oz.au

``When the going gets wierd, the weird turn pro...''



More information about the Comp.unix.wizards mailing list