From: kaih@khms.westfalen.de (Kai Henningsen)
To: linux-kernel@vger.kernel.org
Subject: Re: VFS locking: f_pos thread-safe ?
Date: 08 Feb 2004 17:58:00 +0200 [thread overview]
Message-ID: <92VRVYaHw-B@khms.westfalen.de> (raw)
In-Reply-To: <pan.2004.02.06.18.59.44.936432@smurf.noris.de>
smurf@smurf.noris.de (Matthias Urlichs) wrote on 06.02.04 in <pan.2004.02.06.18.59.44.936432@smurf.noris.de>:
> Hi, viro wrote:
>
> > "Somebody made a guess about undefined behaviour"
>
> Guess what? The manpage says that read(2) return N bytes and advances the
> file pointer by N bytes. It doesn't talk, much less caution, about threads.
That's a defect in the man page, then.
POSIX says on <http://www.opengroup.org/onlinepubs/007904975/functions/
read.html>:
[...]
DESCRIPTION
The read() function shall attempt to read nbyte bytes from the file
associated with the open file descriptor, fildes, into the buffer pointed
to by buf. The behavior of multiple concurrent reads on the same pipe,
FIFO, or terminal device is unspecified.
[...]
That's a pretty explicit warning exactly where one would expect it.
If Linux read(2) doesn't say something like that, I'll consider that a
serious bug.
OTOH ...
> YOU may immediately know, based on your kernel knowledge or whatever, that
> things get somewhat undefined when two threads do that at the same time,
> but it's NOT AT ALL obvious to a "normal" application programmer. There's
> plenty of system calls that CAN be done concurrently, after all.
... these days, programmers really *should* know enough to consult a free,
current, and easily readable version of the relevant standard!
(If you forget where it is, it's easy to find from <http://www.unix-
systems.org/>.)
> Please save your "translations" for stupid ideas that are obviously so
> without in-depth kernel knowledge or equivalent.
... such as the current case.
MfG Kai
next prev parent reply other threads:[~2004-02-08 18:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-06 9:09 VFS locking: f_pos thread-safe ? Matt
2004-02-06 9:16 ` Andrew Morton
2004-02-06 9:26 ` Matt
2004-02-06 9:35 ` Andrew Morton
2004-02-06 10:19 ` Matthias Urlichs
2004-02-06 11:18 ` viro
2004-02-06 18:59 ` Matthias Urlichs
2004-02-06 19:54 ` Werner Almesberger
2004-02-08 15:58 ` Kai Henningsen [this message]
2004-02-19 15:14 ` Pavel Machek
[not found] ` <20040206101941.4cd9c882.shemminger@osdl.org>
2004-02-06 18:47 ` Matthias Urlichs
2004-02-06 13:50 ` Werner Almesberger
2004-02-06 13:56 ` viro
2004-02-06 14:24 ` Werner Almesberger
-- strict thread matches above, loose matches on Subject: below --
2004-02-06 7:12 Werner Almesberger
2004-02-06 7:55 ` Andrew Morton
2004-02-06 18:37 ` Joel Becker
2004-02-06 19:05 ` Matthias Urlichs
2004-02-07 1:35 ` Joel Becker
2004-02-06 20:09 ` Werner Almesberger
2004-02-06 20:56 ` Valdis.Kletnieks
2004-02-07 0:55 ` Werner Almesberger
2004-02-06 20:54 ` Andries Brouwer
2004-02-07 23:45 ` Werner Almesberger
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=92VRVYaHw-B@khms.westfalen.de \
--to=kaih@khms.westfalen.de \
--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