Roland McGrath <[EMAIL PROTECTED]> writes:

> Saying "bidirectional pipe" is descriptive too. :-) They're the same thing.
> As we discussed in great detail here at the time, `pipe' now creates a
> bidirectional pipe, i.e. it creates a socketpair and does not call
> shutdown.

You ought to set some flag somewhere so that you get the PIPE_BUF
behaviour for pipes, but *not* for socketpairs, right?

Problem is as follows: Say I want to write 200 bytes, and 200 <
PIPE_BUF. I use non-blocking i/o, and call select to wait until the fd
is writable. Lets assume that at this point, there's 100 bytes left in
the pipe buffers. Then write will fail: It won't do a partial write of
100 bytes, because it wants to guarantee that writes smaller than
PIPE_BUF are atomic.

This makes it painful to use pipes with non-blocking i/o (the easiest
work-around is to fall back to writing a single byte whenever select
says the fd is writable, but write fails). Or simply use socketpair
instead, as that doesn't have the PIPE_BUF behaviour; in the above
example write ought to return 100, and the next select call will wait
until there's more buffer space.

Regards,
/Niels

_______________________________________________
Bug-hurd mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-hurd

Reply via email to