Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 Deal with timespecs properly in futimens...
details: https://anonhg.NetBSD.org/src/rev/613d4d1549c0
branches: trunk
changeset: 788704:613d4d1549c0
user: matt <matt%NetBSD.org@localhost>
date: Thu Jul 18 14:07:43 2013 +0000
description:
Deal with timespecs properly in futimens and utimensat.
PR/48060
diffstat:
sys/compat/netbsd32/netbsd32_fs.c | 53 +++++++++++++++++++++++++-------------
1 files changed, 35 insertions(+), 18 deletions(-)
diffs (94 lines):
diff -r 7d86a4db7a54 -r 613d4d1549c0 sys/compat/netbsd32/netbsd32_fs.c
--- a/sys/compat/netbsd32/netbsd32_fs.c Thu Jul 18 14:06:27 2013 +0000
+++ b/sys/compat/netbsd32/netbsd32_fs.c Thu Jul 18 14:07:43 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_fs.c,v 1.65 2013/07/18 13:43:32 matt Exp $ */
+/* $NetBSD: netbsd32_fs.c,v 1.66 2013/07/18 14:07:43 matt Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.65 2013/07/18 13:43:32 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.66 2013/07/18 14:07:43 matt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1145,16 +1145,13 @@
} */
struct netbsd32_stat sb32;
struct stat sb;
- unsigned int nd_flag;
+ int follow;
int error;
- if (SCARG(uap, flag) & AT_SYMLINK_NOFOLLOW)
- nd_flag = NOFOLLOW;
- else
- nd_flag = FOLLOW;
+ follow = (SCARG(uap, flag) & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW;
error = do_sys_statat(l, SCARG(uap, fd), SCARG_P32(uap, path),
- nd_flag, &sb);
+ follow, &sb);
if (error)
return error;
netbsd32_from_stat(&sb, &sb32);
@@ -1171,14 +1168,23 @@
syscallarg(netbsd32_timespecp_t) tptr;
syscallarg(int) flag;
} */
- struct sys_utimensat_args ua;
+ struct netbsd32_timespec ts32[2];
+ struct timespec ts[2];
+ int follow;
+ int error;
+
+ if ((error = copyin(SCARG_P32(uap, tptr), ts32, sizeof(ts32))) != 0)
+ return (error);
- NETBSD32TO64_UAP(fd);
- NETBSD32TOP_UAP(path, const char);
- NETBSD32TOP_UAP(tptr, const struct timespec);
- NETBSD32TO64_UAP(flag);
+ netbsd32_to_timespec(&ts32[0], &ts[0]);
+ netbsd32_to_timespec(&ts32[1], &ts[1]);
+
+ follow = (SCARG(uap, flag) & AT_SYMLINK_NOFOLLOW) ? NOFOLLOW : FOLLOW;
- return sys_utimensat(l, &ua, retval);
+ error = do_sys_utimensat(l, SCARG(uap, fd), NULL,
+ SCARG_P32(uap, path), follow, ts, UIO_SYSSPACE);
+
+ return error;
}
int
@@ -1265,10 +1271,21 @@
syscallarg(int) fd;
syscallarg(netbsd32_timespecp_t) tptr;
} */
- struct sys_futimens_args ua;
+ struct netbsd32_timespec ts32;
+ struct timespec ts;
+ file_t *fp;
+ int error;
+
+ if ((error = copyin(SCARG_P32(uap, tptr), &ts32, sizeof(ts32))) != 0)
+ return (error);
- NETBSD32TO64_UAP(fd);
- NETBSD32TOP_UAP(tptr, const struct timespec *);
+ netbsd32_to_timespec(&ts32, &ts);
- return sys_futimens(l, &ua, retval);
+ /* fd_getvnode() will use the descriptor for us */
+ if ((error = fd_getvnode(SCARG(uap, fd), &fp)) != 0)
+ return (error);
+ error = do_sys_utimensat(l, AT_FDCWD, fp->f_data, NULL, 0,
+ &ts, UIO_SYSSPACE);
+ fd_putfile(SCARG(uap, fd));
+ return (error);
}
Home |
Main Index |
Thread Index |
Old Index