From: Simon Kirby <sim@netnation.com>
To: linux-kernel@vger.kernel.org
Subject: read() details
Date: Thu, 26 Jul 2001 14:47:19 -0700 [thread overview]
Message-ID: <20010726144719.A2098@netnation.com> (raw)
Just some things I've always wondered about...
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
portable to make such an assumption?
...Or is it always better to make sure read() returns 0 before assuming
EOF, perhaps because the kernel may want to promote contiguous-page
read()s or for some other reason?
On a related note, would there be a win in altering the first read() size
(at the beginning of a read loop) to allow the kernel to serve the
subsequent read requests from contiguous pages? (This is assuming that
an lseek() happened first which would misalign the further read()s with
page boundaries.)
Simon-
[ Stormix Technologies Inc. ][ NetNation Communications Inc. ]
[ sim@stormix.com ][ sim@netnation.com ]
[ Opinions expressed are not necessarily those of my employers. ]
next reply other threads:[~2001-07-26 21:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-26 21:47 Simon Kirby [this message]
2001-07-26 22:24 ` read() details Alan Cox
2001-07-26 22:31 ` Simon Kirby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20010726144719.A2098@netnation.com \
--to=sim@netnation.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox