In linux, is it possible to do partial reads on a regular file
Posted
by
Jimm
on Stack Overflow
See other posts from Stack Overflow
or by Jimm
Published on 2012-11-28T20:53:40Z
Indexed on
2012/11/29
5:04 UTC
Read the original article
Hit count: 122
I need to write an application that spits out log entries to a regular file at a very fast rate. Also, there will be another process, that can read the same file concurrently at the time, other process would be writing to it. I have following questions
How does read() determine EOF, specially in the case, where the underlying file could be concurrently being modified?
Is it possible for read() to return partially written data from the other process write? For example, the write process wrote half a line and read would pick that half line and return?
The application would be written in C on linux 2.6.x using Ex4 filesystem
UPDATE: Below link points to the patch, that locks inode in EXT4, before reading and writing. http://patchwork.ozlabs.org/patch/91834/
© Stack Overflow or respective owner