pipes & O_NONBLOCK

Manfred Spraul (manfreds@colorfullife.com)
Wed, 08 Sep 1999 11:17:41 +0200


I noticed that if a pipe is opened with O_NONBLOCK, then pipe_read()
calls down_trylock(), and pipe_write() calls down_interruptible().

Why does pipe_read() call down_trylock() instead of
down_interruptible()?
If the pipe buffer is full, and 2 thread try to read 10 bytes, then the
current code would return -EAGAIN for one of the calls. I'm not sure,
but this seems wrong.

Obviously, pipe_read() with O_NONBLOCK must not wait for new data from
user space, but since POSIX allows preemptive multitasking, the kernel
can schedule() around without violating the standard.

--
	Manfred

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/