Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!ncar!midway!gargoyle!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.programmer Subject: Re: FIFOs Message-ID: <1991Jan21.161245.27286@chinet.chi.il.us> Date: 21 Jan 91 16:12:45 GMT References: <11376@helios.TAMU.EDU> Organization: Chinet - Public Access UNIX Lines: 18 In article <11376@helios.TAMU.EDU> byron@archone.tamu.edu (Byron Rakitzis) writes: >My question is this: is there anything "foo" can do so that when "foo" >is finished writing, cat's read() returns without blocking? Setting >the O_NDELAY flag from cat's side is not allowed, since cat has to >treat the FIFO as any other argument. However, the shell does have >some control over how "foo" writes to the FIFO. It sounds like you are opening the FIFO for read/write at both ends, which gives the behaviour you describe (and sometimes it is useful). If shell opens one side read-only and the other side write-only, the FIFO will provide a normal EOF when the write side is closed. Note that the open()'s will block waiting for each other when you do it this way so you will have to fork first to allow them to complete without a deadlock. Les Mikesell les@chinet.chi.il.us