Subject: Re: Not beer, or why is the pipe so small?
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 02/25/2003 23:46:29
>> Posix does not say it explicitly, but it does if you read "between
>> the lines", since writes of PIPE_BUF bytes are atomic with pipes,
>> and since a writable pipe should absorb *some* output when a
>> non-blocking writer writes to it (the sender should not see
>> EWOULDBLOCK), a writable pipe must have at least PIPE_BUF bytes
>> free.

> just to play the devil's advocate...
> i can easily interpret what you say above:
> 	writes of PIPE_BUF bytes are atomic with pipes
> to mean that "only writes of up to PIPE_BUF bytes are atomic with
> pipes, and that larger writes may not be atomic".


> that would allow both a write of one byte to succeed and be perfectly
> correct, and for select()/poll() to return when room for one byte to
> be written was available.

Ah, but it wouldn't allow for the latter.  Because then, if the
application wanted to write two bytes, the two-byte write must be
atomic (less than PIPE_BUF), and there isn't room for the whole thing,
therefore the write would have to return
select()/poll() shouldn't've returned a writable indication.

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B