Re: problems in pread(2).

Stephen C. Tweedie (sct@redhat.com)
Wed, 27 Jan 1999 12:43:46 GMT


Hi,

On Mon, 25 Jan 1999 12:38:50 +0000 (GMT), Tigran Aivazian
<tigran@sco.COM> said:

> Just to make my previous mail more concrete, the following program
> illustrates a problem with current implementation of pread(2). Namely,
> reading beyond the end of file should (by Single UNIX spec) set
> errno=EOVERFLOW. Currently it returns 0, and sets errno =0 (Success),
> whilst leaving the buffer intact.

No. EOVERFLOW is specifically reserved for a file offset which is too
large, not just one which is beyond the current file's EOF. In
particular, the Large File Summit standard clearly specifies that the
EOVERFLOW watermark is in fact variable: you can open a large (>2GB)
file with 32-bit open() and the result will be EOVERFLOW if you access
beyond the 2GB mark, but open the same file with the 64-bit open64() and
EOVERFLOW will only happen when you exceed the true maximum file offset.

All this is not to be confused with the maximum file _size_, exceeding
which gives EFBIG.

> However, if you set the offset to something negative, it does not set
> errno=EINVAL (again required by Single UNIX) but sets it to 0 and returns
> 0.

Good point; it is now on my TODO list...

--Stephen

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