[comp.lang.c] stat

brb@akgua.ATT.COM (Brian R. Bainter) (10/20/88)

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.

If anyone could give me some leads as to why this is happening, I would
be most greatful to the point of rewarding them with many attapersons.

Thanks in advance,

-- 
	Brian R. Bainter   KA7TXA

 AT&T Technologies Atlanta Works
 {cbosgd, gatech, ihnp4, moss, mtune, ulysses}akgua!brb

decot@hpisod2.HP.COM (Dave Decot) (10/21/88)

> 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