FIFOs
Leslie Mikesell
les at chinet.chi.il.us
Tue Jan 22 03:12:45 AEST 1991
In article <11376 at helios.TAMU.EDU> byron at 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 at chinet.chi.il.us
More information about the Comp.unix.programmer
mailing list