Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!att!chinet!les From: les@chinet.chi.il.us (Leslie Mikesell) Newsgroups: comp.unix.questions Subject: Re: Sysv pipes/FIFO's & blocking Summary: I meant when the writer hasn't closed its end Message-ID: <9362@chinet.chi.il.us> Date: 25 Aug 89 18:25:40 GMT References: <9348@chinet.chi.il.us> Reply-To: les@chinet.chi.il.us (Leslie Mikesell) Organization: Chinet - Public Access Unix Lines: 36 In article <9348@chinet.chi.il.us> les@chinet.chi.il.us (Leslie Mikesell) writes: >What is supposed to happen under sysV if a pipe or FIFO contains >3 characters and a read() requests 4 characters? What about fread()? >Is it documented anywhere? I've received some mail replies that assumed that the writer was finished and had closed the writing end of the pipe, in which case both read() and fread() return the 3 available characters. I wanted to know about the case where the reader catches up, but the writer isn't finished. On SysVr3.2 (AT&T 6386), read() will return the 3 available characters, fread() will wait until 4 characters are available or EOF. This surprised me a little: ----------------- #/bin/sh READ=500 while : do echo "1" done | while : do dd bs=$READ count=1 of=/dev/null done ------------------- It gives a mixture of: 1+0 records in 1+0 records out and 0+1 records in 0+1 records out with the latter form increasing with the size of READ. Why? Les Mikesell