From 163be2ac64fc55300aa9760406af6f1c2fadeca8 Mon Sep 17 00:00:00 2001 From: yamt Date: Sat, 1 Oct 2005 06:13:42 +0000 Subject: [PATCH] change_utimes: use nanotime(9) rather than time(9). --- sys/kern/vfs_syscalls.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index b1672000b5bf..bb6658e07e99 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.232 2005/09/25 21:57:40 jmmv Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.233 2005/10/01 06:13:42 yamt Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.232 2005/09/25 21:57:40 jmmv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.233 2005/10/01 06:13:42 yamt Exp $"); #include "opt_compat_netbsd.h" #include "opt_compat_43.h" @@ -2771,7 +2771,6 @@ sys_lutimes(struct lwp *l, void *v, register_t *retval) static int change_utimes(struct vnode *vp, const struct timeval *tptr, struct proc *p) { - struct timeval tv[2]; struct mount *mp; struct vattr vattr; int error; @@ -2780,20 +2779,20 @@ change_utimes(struct vnode *vp, const struct timeval *tptr, struct proc *p) return (error); VATTR_NULL(&vattr); if (tptr == NULL) { - microtime(&tv[0]); - tv[1] = tv[0]; + nanotime(&vattr.va_atime); + vattr.va_mtime = vattr.va_atime; vattr.va_vaflags |= VA_UTIMES_NULL; } else { + struct timeval tv[2]; + error = copyin(tptr, tv, sizeof(tv)); if (error) goto out; + TIMEVAL_TO_TIMESPEC(&tv[0], &vattr.va_atime); + TIMEVAL_TO_TIMESPEC(&tv[1], &vattr.va_mtime); } VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - vattr.va_atime.tv_sec = tv[0].tv_sec; - vattr.va_atime.tv_nsec = tv[0].tv_usec * 1000; - vattr.va_mtime.tv_sec = tv[1].tv_sec; - vattr.va_mtime.tv_nsec = tv[1].tv_usec * 1000; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0); out: