summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkensmith <kensmith@FreeBSD.org>2005-02-02 00:21:38 +0000
committerkensmith <kensmith@FreeBSD.org>2005-02-02 00:21:38 +0000
commit4130080e12ab49a659e616322a16e9db22726595 (patch)
tree0e539d0e3639c3979c39b66d95f7f7da60ebff96
parent4ab36f5f9693a3b43be9e19c6c45db0b6f095edf (diff)
downloadFreeBSD-src-4130080e12ab49a659e616322a16e9db22726595.zip
FreeBSD-src-4130080e12ab49a659e616322a16e9db22726595.tar.gz
It was noticed that we do not change a file's access time when it gets
executed. This appears to violate most of the UNIX-ish standards. One example quote from: http://www.opengroup.org/onlinepubs/009695399/functions/exec.html Upon successful completion, the exec functions shall mark for update the st_atime field of the file. If an exec function failed but was able to locate the process image file, whether the st_atime field is marked for update is unspecified. Should the exec function succeed, the process image file shall be considered to have been opened with open(). This appears to take care of it for ufs filesystems, doing the necessary sanity checks (read-only filesystem, etc) without violating any other standards (setting atime for any open appears to be allowed in any standards I could find). Noticed by: cperciva Reviewed by: kan, rwatson
-rw-r--r--sys/ufs/ufs/ufs_vnops.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 3f86f38..b769ca8 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -254,6 +254,12 @@ ufs_open(struct vop_open_args *ap)
(ap->a_mode & (FWRITE | O_APPEND)) == FWRITE)
return (EPERM);
vnode_create_vobject(vp, DIP(ip, i_size), ap->a_td);
+ /*
+ * Set the access time - this catches normal open(2) of files
+ * as well as execve(2).
+ */
+ ip->i_flag |= IN_ACCESS;
+ ufs_itimes(vp);
return (0);
}
OpenPOWER on IntegriCloud