Subject: Re: Not beer, or why is the pipe so small?
To: Viktor Dukhovni <viktor@dukhovni.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 02/25/2003 17:58:18
> The problem with a small PIPE_BUF is not any reader side behaviour, but
> rather that a pipe with as few as 512 bytes free may select ready for
> writing. Now perhaps the moral equivalent of the low-water mark for the
> new pipes is 4K or more, and the problem with commands not timing out was
> due to the problem with Postfix trying to kill the child process with the
> wrong credentials discovered while analyzing the I/O issues. If that is
> so, I withdraw my complaint. If on the other hand a selected for write
> pipe can have only 512 bytes free, I consider waking up the writer with so
> little space a (legal) misfeature.

For the portable behaviour see:
http://www.opengroup.org/onlinepubs/009604499/functions/write.html

Basically only writes of less than {PIPE_BUF} + 1 bytes are guaranteed
not to be split.  Longer writes can be split into arbitrary chunks.

In particular if there is 1 byte of space in a pipe, a write with
O_NONBLOCK set will add 1 byte to the pipe then return.

There is nothing on the select page that suggests that a pipe isn't
writable as soon as there is one byte of space in it.

	David

-- 
David Laight: david@l8s.co.uk