mmap( ) is supposed to update the access time when using PROT_READ. I discovered that, on my system (FreeBSD 5.4), it doesn't. The test is easy to do: cp uses mmap( ) if the file's size is less than 8mb (check /usr/src/bin/cp/utils.c)
Code:
$ ls -lu /usr/src/kerberos5/README
-rw-r--r-- 1 root wheel 267 Oct 29 18:23 /usr/src/kerberos5/README
$ cp /usr/src/kerberos5/README /tmp
$ ls -lu /usr/src/kerberos5/README
-rw-r--r-- 1 root wheel 267 Oct 29 18:23 /usr/src/kerberos5/README
$ md5 /usr/src/kerberos5/README
MD5 (/usr/src/kerberos5/README) = 3ebe0c3e90e87e987a03435858dfe535
$ ls -lu /usr/src/kerberos5/README
-rw-r--r-- 1 root wheel 267 Nov 15 22:00 /usr/src/kerberos5/README
My mount flags don't contain "noatime", but they're irrelevant because the atime is updated when using read( ).
Code:
$ grep /usr /etc/fstab
/dev/ad0s2d /usr ufs rw 2 2
I've found another bug where mmap( ) accepts a zero length (POSIX states that mmap shall fail), while munmap( ) does complain about it.
http://www.opengroup.org/onlinepubs/...ions/mmap.html
Can anyone test it in different systems and share the results?