On Linux, suppose I do a
write()
to end of a file, and while this is still completing, from another thread I do a stat-type call on that file (such as fstat()
or lstat()
).
I would expect, that the stat-buffer st_size
field during that time, would return between, the previous size of the file before the write()
, and, the current size of valid data written already present in the file. So that, if I were to use the st_size
to mmap()
the file with 0 offset, I will get valid data; perhaps not all the data yet, OK, but at least, all the previous contents of the file, plus perhaps some valid already written data.
Is that guaranteed ?
Asked by Mark Galeck
(223 rep)
May 17, 2023, 02:14 AM
Last activity: May 17, 2023, 02:23 AM
Last activity: May 17, 2023, 02:23 AM