stat(2) question

Dave Decot decot at hpisod2.HP.COM
Fri Oct 21 12:19:40 AEST 1988


> If anyone could give me some help with this I would be most greatful.
> The problem is this. I have a program which calls stat(2) once a second
> to check the st_atime (time of last access) of a certain file. This works
> fine until the file has been accessed by another program running at the
> same time as my monitoring program. The access time actually gets changed,
> but the st_atime value in the monitoring program never changes.

When a file is accessed, the st_[amc]time fields of the structure are
"marked for update", but they do not necessarily actually get updated
until one of various events occur.  One of these events is closing the file.

Dave



More information about the Comp.lang.c mailing list