Strange time() vs. stat() bug
smb at ulysses.UUCP
smb at ulysses.UUCP
Thu Dec 8 07:32:35 AEST 1983
To save memory space, in-core i-nodes don't have modification/acces/change
times included. Instead, they have bit-flags that tell sync() to update
the disk version of those fields. Since sync() is normally invoked every
30 seconds, the times are usually "accurate enough".
Now -- stat() prefers to use the disk-resident copy of the i-node. This
is proper for many reasons, not least of which is so that it can get at
those timestamps. To ensure that the disk copy is current, stat calls sync()
first -- which updates the disk copy, and uses the time value as of when
sync() was called.
More information about the Comp.unix.wizards
mailing list