[MPlayer-dev-eng] Re: kernel: to do_select(pipe) or not to do

D Richard Felker III dalias at aerifal.cx
Mon Nov 22 23:10:51 CET 2004


On Mon, Nov 22, 2004 at 12:49:42PM -0500, Daniel Eischen wrote:
> On Mon, 22 Nov 2004, D Richard Felker III wrote:
> 
> > On Sun, Nov 21, 2004 at 08:21:58PM -0800, Linus Torvalds wrote:
> >
> > hi linus.
> >
> > > On Mon, 22 Nov 2004, Ivan Kalvachev wrote:
> > > >
> > > > You are very wrong at this point. A full write WILL block if it writes
> > > > an PIPE_SIZE+1 bytes. And it have nothing to do with select()!
> > >
> > > Don't bother arguing when you don't know what you're talking about.
> >
> > i think some of us do know what we're talking about... if you think
> > otherwise please quote the relevant parts of posix.
> >
> > > As I already mentioned, "select()" usage ONLY MAKES SENSE FOR NONBLOCKING
> > > FILE DESCRIPTORS.
> > >
> > > Of _course_ a write() will block if the fd is blocking. But if you have a
> > > nonblocking fd it will NOT block.
> >
> > a write should never block if select indicated that the fd was
> > writeable. it should write however many bytes can be written
> > immediately and return that number. to my knowledge, many programs
> > assume this behavior (which i expect is correct, but i don't have
> > posix in front of me...) and will have strange problems if the system
> > behaves otherwise.
> 
> I hope you are only referring to non-blocking I/O above.  For
> blocking I/O, the write request must be fully satisfied before
> returning, otherwise the caller blocks.  When you call select(),
> the kernel has no idea how much you want to write.  If there's
> room for a byte to be written, but no more, select() can
> return with the fd ready for writing.
> 
> Please see:
> 
>   http://www.opengroup.org/onlinepubs/009695399/functions/write.html

ok, this is what i wanted to see.

rich




More information about the MPlayer-dev-eng mailing list