Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!wugate!uunet!munnari.oz.au!csc!ccadfa!usage!basser!necisa!boyd From: boyd@necisa.ho.necisa.oz (Boyd Roberts) Newsgroups: comp.unix.wizards Subject: Re: how can I get filename from file descriptor? Message-ID: <1189@necisa.ho.necisa.oz> Date: 29 Sep 89 00:38:17 GMT References: <9353@chinet.chi.il.us> <1639@cbnewsl.ATT.COM> <10850@smoke.BRL.MIL> <14280@super.ORG> <11099@smoke.BRL.MIL> <862@cirrusl.UUCP> <11113@smoke.BRL.MIL> <867@cirrusl.UUCP> Organization: NEC Information Systems Australia Pty. Ltd. Lines: 25 In article <867@cirrusl.UUCP> dhesi%cirrusl@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@necisa.ho.necisa.oz.au ``When the going gets wierd, the weird turn pro...''