This is the mail archive of the
mailing list for the glibc project.
- From: Ian Turner <ian at zmanda dot com>
- To: libc-alpha at sources dot redhat dot com
- Date: Tue, 27 Sep 2005 15:57:37 -0700
- Subject: atime preservation
A long time ago, someone added O_NOATIME in the glibc documentation: an option
to open that would avoid changing the atime on read(). More recently, Linux
2.6.8 implemented this option, and soon tar will support it as
However, O_NOATIME has some limitations, which should be addressed in a future
version of glibc:
1) There's no way to tell if the kernel supports O_NOATIME or not, and support
may vary by file or filesystem. It is pretty much impossible, for example, to
do O_NOATIME on any NFS filesystem. Right now Linux just silently ignores the
flag, but it would be best if EINVAL is documented as a possible open()
2) There is no way to read directories or symlinks without changing atime.
Through using the Linux open() and getdents() system calls, one can in fact
read directories without touching their atime. But it would be best if there
were a documented interface into opendir() to accomplish this end. Similarly,
there needs to be a version of readlink() that won't touch the atime on the
To fix these, I propose the following changes. I'm happy to do the coding:
1) open() may return EINVAL if it is passed O_NOATIME and the file does not
support that flag.
2) new system calls readlinkopt() and opendiropt(), which work like readlink()
and opendir() but take an extra flag argument, the only flag (at present)
being O_NOATIME. They set EINVAL if the file is not a symbolic link (for
readlinkopt()) or does not support a passed flag.
Comments are very much appreciated.