is stat(2) read-after-write consistent with write(2)?
5
votes
1
answer
178
views
man 2 write
states:
>POSIX requires that a read(2) that can be proved to occur after a write() has returned will return the new data. Note that not all filesystems are POSIX conforming.
In Linux, is this also true for stat(2)
and fstat(2)
, in particular, for the stat.st_size
member?Specifically, if you open a file with
O_CREAT
, successfully write 948427 bytes to it, then either stat or fstat it, are you guaranteed to see a st_size
of 948427?(If so, is this a guarantee for POSIX filesystems, or something that typical Linux filesystems provide in practice, or a property of certain filesystems and not others?)
Asked by Shivaram Lingamneni
(306 rep)
Dec 3, 2023, 08:12 AM
Last activity: Dec 3, 2023, 10:58 PM
Last activity: Dec 3, 2023, 10:58 PM