Re: new compiler warnings

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: new compiler warnings
Дата
Msg-id 7845.1318959313@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: new compiler warnings  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: new compiler warnings
Re: new compiler warnings
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Oct 18, 2011 at 1:01 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> The chunks are sent indivisibly, because they are less than the pipe
>> buffer size. �Read the pipe man page. �It's guaranteed that the write
>> will either succeed or fail as a whole, not write a partial message.
>> If we cared to retry a failure, there would be some point in checking
>> the return code.

> On MacOS X v10.6.8, I see no such guarantee in the pipe(2) man page.

Sorry, maybe write(2) is the place to look.  The Single Unix Spec quoth
(at http://pubs.opengroup.org/onlinepubs/9699919799/):
Write requests to a pipe or FIFO shall be handled in the sameway as a regular file with the following exceptions:
There is no file offset associated with a pipe, hence each writerequest shall append to the end of the pipe.
Write requests of {PIPE_BUF} bytes or less shall not beinterleaved with data from other processes doing writes on
thesamepipe. Writes of greater than {PIPE_BUF} bytes may have datainterleaved, on arbitrary boundaries, with writes by
otherprocesses,whether or not the O_NONBLOCK flag of the file statusflags is set.
 
If the O_NONBLOCK flag is clear, a write request may cause thethread to block, but on normal completion it shall return
nbyte.

Note the last in particular.  Short writes are specifically disallowed
on pipes.

If this were not the case, the logging collector protocol would be
useless.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: synchronized snapshots
Следующее
От: Andrew Dunstan
Дата:
Сообщение: Re: new compiler warnings