Re: problems in pread(2).

Itai Nahshon (nahshon@actcom.co.il)
Mon, 25 Jan 1999 21:03:16 +0200 (EET)


Look at <http://www.opengroup.org/onlinepubs/7908799/xsh/pread.html>.

Pread should give exactly the same result as read. AFAIK read
does (and has always) retrun 0 when trying to read at or beyond the EOF.

The opengroup man page for read has this unclear clause about EOVERFLOW:
[EOVERFLOW]
The file is a regular file, nbyte is greater than 0, the
starting position is before the end-of-file and the starting
position is greater than or equal to the offset maximum
established in the open file description associated with fildes.

What is "open file description" (should I read descriptor ???) ?
What is "the offset maximum established in the ..". Where does it
exist (and how do I set it) in regular files.

Notice that talks only about "regular file". This might have a meaning
with some device files where there is no explicit EOF [lseek(fd, off, SEEK_END)
cannot be used].

Itai

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

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