[lkml]   [2004]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: VFS locking: f_pos thread-safe ? (Matthias Urlichs)  wrote on 06.02.04 in <>:

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


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

> 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
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:00    [W:0.087 / U:0.140 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site