Re: [PROBLEM+PATCH] 2.X zero-length read on non-empty pipe returns EAGAIN

Alan Cox (alan@lxorguk.ukuu.org.uk)
Mon, 7 Jun 1999 11:32:24 +0100 (BST)


> This problem was observed with kernel 2.2.9 on an i386, but appears
> from the source to be present in all 2.X kernels.
>
> Description: a read() with count=0 on a pipe that is not empty
> should return 0; instead it returns -1 with EAGAIN.

Yes. That is incorrect according to SUS.

> Fix: *If* the manual page for read() is correct in saying that
> a read of length zero should always return 0 and do nothing else,

[It is]

> then the enclosed patch is probably right. (Somebody who knows, please
> check that it should indeed come after the invalid seek test---I don't
> know enough about what the fs routines are defined to do.)

The seek test is for pread(). The spec is unclear if that test comes
first

Alan

-
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/