Index: kern/kern_exec.c =================================================================== RCS file: /home/dcvs/src/sys/kern/kern_exec.c,v retrieving revision 1.63 diff -u -r1.63 kern_exec.c --- kern/kern_exec.c 6 Jan 2008 16:55:51 -0000 1.63 +++ kern/kern_exec.c 20 May 2008 19:09:53 -0000 @@ -465,6 +465,9 @@ exec_setregs(imgp->entry_addr, (u_long)(uintptr_t)stack_base, imgp->ps_strings); + /* Set the access time on the vnode */ + vn_mark_atime(imgp->vp, td); + /* Free any previous argument cache */ if (p->p_args && --p->p_args->ar_ref == 0) FREE(p->p_args, M_PARGS); Index: kern/vfs_subr.c =================================================================== RCS file: /home/dcvs/src/sys/kern/vfs_subr.c,v retrieving revision 1.114 diff -u -r1.114 vfs_subr.c --- kern/vfs_subr.c 18 May 2008 05:54:25 -0000 1.114 +++ kern/vfs_subr.c 20 May 2008 19:35:54 -0000 @@ -2114,3 +2114,16 @@ return(0); } +void +vn_mark_atime(struct vnode *vp, struct thread *td) +{ + struct vattr atimeattr; + struct proc *p = td->td_proc; + + if ((vp->v_mount->mnt_flag & (MNT_NOATIME | MNT_RDONLY)) == 0) { + vattr_null(&atimeattr); + vfs_timestamp(&atimeattr.va_atime); + VOP_SETATTR(vp, &atimeattr, p->p_ucred); + } +} + Index: sys/vnode.h =================================================================== RCS file: /home/dcvs/src/sys/sys/vnode.h,v retrieving revision 1.80 diff -u -r1.80 vnode.h --- sys/vnode.h 18 May 2008 21:47:05 -0000 1.80 +++ sys/vnode.h 20 May 2008 19:31:17 -0000 @@ -520,6 +520,7 @@ int vn_stat (struct vnode *vp, struct stat *sb, struct ucred *cred); cdev_t vn_todev (struct vnode *vp); void vfs_timestamp (struct timespec *); +void vn_mark_atime(struct vnode *vp, struct thread *t); int vn_writechk (struct vnode *vp, struct nchandle *nch); int ncp_writechk(struct nchandle *nch); int vop_stdopen (struct vop_open_args *ap); Index: vm/vm_mmap.c =================================================================== RCS file: /home/dcvs/src/sys/vm/vm_mmap.c,v retrieving revision 1.39 diff -u -r1.39 vm_mmap.c --- vm/vm_mmap.c 30 Apr 2007 07:18:57 -0000 1.39 +++ vm/vm_mmap.c 20 May 2008 19:10:34 -0000 @@ -983,6 +983,7 @@ boolean_t fitit; vm_object_t object; struct vnode *vp = NULL; + struct thread *td = curthread; struct proc *p; objtype_t type; int rv = KERN_SUCCESS; @@ -1064,6 +1065,9 @@ object = vm_pager_allocate(type, handle, objsize, prot, foff); if (object == NULL) return (type == OBJT_DEVICE ? EINVAL : ENOMEM); + /* Set the access time on the vnode */ + vn_mark_atime(handle, td); + docow = MAP_PREFAULT_PARTIAL; }