Re: -EFAULT on invalid pointer

ralf@uni-koblenz.de
Tue, 20 Oct 1998 22:56:48 +0200


On Tue, Oct 20, 1998 at 06:58:15PM +1300, Chris Wedgwood wrote:

> A short buffer under 2.1.x causes a short read, it does not return
> EFAULT (last time I checked anyhow).

Cite from the UNIX V7 read(2) manpage ``It is not guaranteed that all nbytes
bytes will be read''. In other words code which is expecting the return
value to be either -1, 0 or nbytes is broken since begin of time.

The whole thread is somewhat bogus because of the atomicity and threading
issues involved in the interface and which resulted in the new semantics.
So now think about what would happen on 2.0 and what would happen on 2.1
if of two threads the one is writing a buffer and the other is unmapping
parts of that buffer? At the point when the writing thread encounters
the problem, it can either return an error or a number of bytes written.
What is the appropriate answer? Only returning the number of bytes makes
sense since we've already written the data and we can't undo this and
just return EFAULT.

Ralf

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