This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

What operations set st_amode on a directory?


Is there any specific information on this? My problem is that I have a lister program that reads and/or sets the access timestamp, and it works differently on different distributions when operating on a directory.

I've only tried it on Centos 4.4 (2.6.9, glibc 2.3.4) and Fedora 8 (2.6.23, glibc-2.7).

My program uses 'scandir' to step through the contents of a directory, and 'lstat' to get st_atime for each entry in the directory (excluding '.' and '..'). It then uses 'lstat' to get st_atime for the directory itself.

On Centos 4.4, 'scandir' on a directory's contents changes st_atime for that directory. On F8, it doesn't (although there do seem to be some circumstances where it can; I haven't got to the bottom of this).

A simpler test is to get st_atime for a directory name, then 'ls' that directory, and then get st_atime again. For Centos 4.4, the access time changes to the date at which the 'ls' was carried out; for F8, it doesn't change.

If this is unspecified or has changed, can someone suggest a way to get the attributes of a directory tree without changing those attributes? I can work around this by reading a directory's attributes before examining the contents of the directory, and then restoring the attributes afterwards, but this isn't ideal.

Thanks -

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]