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

D Richard Felker III dalias at aerifal.cx
Mon Nov 22 16:35:52 CET 2004


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.

> What "select()" returns is not whether something blocks or not. Never has 
> been. What the return value of select() means is whether you can do a 
> successful nonblocking write.

i have never seen documentation indicating that select is only meant
to be used with non-blocking io. on the other hand, select is always
presented as an alternative method to nonblocking io.

rich




More information about the MPlayer-dev-eng mailing list