[net.unix-wizards] Unix System 3 Pipe Semantics

csk@UCLA-Security@sri-unix (06/06/82)

From: csk at UCLA-Security (Charley Kline)
Date: 23 May 1982 1544-PDT (Sunday)
In version 7 and previous Unix systems, a write to a pipe
was allowed with any byte count -- the write code in rdwri.c looped
until all the data was sent.  Thus, the following two
were almost equivalent:
	command1 | command2
	command1 > file; command2 < file

(The difference is that in command2 in the file case, reads would
not return with byte counts less than requested except at end of file,
while in the pipe case, any read might return with a smaller byte count)

However, in System 3, pipes are restricted to PIPSIZ bytes, and writes
larger than that will always fail!  Writes smaller than that will only
write however much room is left and will return with a count
less than that requested.  Thus, in the above example, 
command1 which may work on a file may fail on a pipe, especially
if it does large writes!

The question I have is, why was this change made for System 3?
(Can any of the bell types on this list explain?)

(Actually, if I had my way, reads would also wait until the
requested bytes were available or end of file, unless a special option
was used, which would make the two cases above exactly equivalent)

--charley kline