Re: read() details

From: Simon Kirby (sim@netnation.com)
Date: Thu Jul 26 2001 - 17:31:17 EST


On Thu, Jul 26, 2001 at 11:24:28PM +0100, Alan Cox wrote:

> > Is it safe to assume that when a single read() call of x bytes a file
> > (the file being locked against other processes appending to it) returns
> > less than x bytes, the next read() will always return 0? If so, is it
>
> No. Posix allows any read to be interrupted. Unix doesn't do this. Even so
> another writer in parallel on the same file will cause what you describe

Well, I was meaning to imply that reads which are interrupted would be
have to be manually restarted. But yes, there is also no guarantee that
huge reads will not return the requested size, which in effect makes any
don't-read-again-just-to-get-an-EOF optimization more trouble than it
would be worth.

Simon-

[ Stormix Technologies Inc. ][ NetNation Communications Inc. ]
[ sim@stormix.com ][ sim@netnation.com ]
[ Opinions expressed are not necessarily those of my employers. ]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Jul 31 2001 - 21:00:29 EST