Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/linux Add utimensat(2) for compat linux.
details: https://anonhg.NetBSD.org/src/rev/c6d1fe9568d1
branches: trunk
changeset: 790183:c6d1fe9568d1
user: njoly <njoly%NetBSD.org@localhost>
date: Tue Sep 24 13:27:49 2013 +0000
description:
Add utimensat(2) for compat linux.
diffstat:
sys/compat/linux/arch/alpha/syscalls.master | 5 +-
sys/compat/linux/arch/amd64/syscalls.master | 5 +-
sys/compat/linux/arch/arm/syscalls.master | 5 +-
sys/compat/linux/arch/i386/syscalls.master | 5 +-
sys/compat/linux/arch/m68k/syscalls.master | 5 +-
sys/compat/linux/arch/mips/syscalls.master | 5 +-
sys/compat/linux/arch/powerpc/syscalls.master | 5 +-
sys/compat/linux/common/linux_fcntl.h | 11 +++++-
sys/compat/linux/common/linux_file.c | 21 ++++++++++-
sys/compat/linux/common/linux_misc.c | 47 +++++++++++++++++++++++++-
10 files changed, 95 insertions(+), 19 deletions(-)
diffs (268 lines):
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/arch/alpha/syscalls.master
--- a/sys/compat/linux/arch/alpha/syscalls.master Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/arch/alpha/syscalls.master Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.78 2013/09/15 12:58:34 njoly Exp $
+ $NetBSD: syscalls.master,v 1.79 2013/09/24 13:27:49 njoly Exp $
;
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -728,7 +728,8 @@
472 UNIMPL move_pages
473 UNIMPL getcpu
474 UNIMPL epoll_wait
-475 UNIMPL utimensat
+475 STD { int|linux_sys||utimensat(int fd, const char *path, \
+ struct linux_timespec *times, int flag); }
476 UNIMPL signalfd
477 UNIMPL timerfd
478 UNIMPL eventfd
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/arch/amd64/syscalls.master
--- a/sys/compat/linux/arch/amd64/syscalls.master Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/arch/amd64/syscalls.master Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.42 2013/04/08 20:54:47 pooka Exp $
+ $NetBSD: syscalls.master,v 1.43 2013/09/24 13:27:49 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -490,7 +490,8 @@
277 UNIMPL sync_file_range
278 UNIMPL vmsplice
279 UNIMPL move_pages
-280 UNIMPL utimensat
+280 STD { int|linux_sys||utimensat(int fd, const char *path, \
+ struct linux_timespec *times, int flag); }
281 UNIMPL epoll_pwait
282 UNIMPL signalfd
283 UNIMPL timerfd_create
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/arch/arm/syscalls.master
--- a/sys/compat/linux/arch/arm/syscalls.master Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/arch/arm/syscalls.master Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.50 2013/04/08 20:54:48 pooka Exp $
+ $NetBSD: syscalls.master,v 1.51 2013/09/24 13:27:49 njoly Exp $
; Derived from sys/compat/linux/arch/*/syscalls.master
; and from Linux 2.4.12 arch/arm/kernel/calls.S
@@ -534,7 +534,8 @@
345 UNIMPL getcpu
346 UNIMPL epoll_wait
347 UNIMPL kexec_load
-348 UNIMPL utimensat
+348 STD { int|linux_sys||utimensat(int fd, const char *path, \
+ struct linux_timespec *times, int flag); }
349 UNIMPL signalfd
350 UNIMPL timerfd_create
351 UNIMPL eventfd
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/arch/i386/syscalls.master
--- a/sys/compat/linux/arch/i386/syscalls.master Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/arch/i386/syscalls.master Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.109 2013/04/08 20:54:48 pooka Exp $
+ $NetBSD: syscalls.master,v 1.110 2013/09/24 13:27:49 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -506,7 +506,8 @@
317 UNIMPL move_pages
318 UNIMPL getcpu
319 UNIMPL epoll_wait
-320 UNIMPL utimensat
+320 STD { int|linux_sys||utimensat(int fd, const char *path, \
+ struct linux_timespec *times, int flag); }
321 UNIMPL signalfd
322 UNIMPL timerfd_create
323 UNIMPL eventfd
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/arch/m68k/syscalls.master
--- a/sys/compat/linux/arch/m68k/syscalls.master Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/arch/m68k/syscalls.master Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.75 2013/04/08 20:54:48 pooka Exp $
+ $NetBSD: syscalls.master,v 1.76 2013/09/24 13:27:49 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -519,7 +519,8 @@
313 UNIMPL kexec_load
314 UNIMPL getcpu
315 UNIMPL epoll_wait
-316 UNIMPL utimensat
+316 STD { int|linux_sys||utimensat(int fd, const char *path, \
+ struct linux_timespec *times, int flag); }
317 UNIMPL signalfd
318 UNIMPL timerfd_create
319 UNIMPL eventfd
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/arch/mips/syscalls.master
--- a/sys/compat/linux/arch/mips/syscalls.master Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/arch/mips/syscalls.master Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.45 2013/04/08 20:54:48 pooka Exp $
+ $NetBSD: syscalls.master,v 1.46 2013/09/24 13:27:50 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -506,7 +506,8 @@
313 UNIMPL epoll_pwait
314 UNIMPL ioprio_set
315 UNIMPL ioprio_get
-316 UNIMPL utimensat
+316 STD { int|linux_sys||utimensat(int fd, const char *path, \
+ struct linux_timespec *times, int flag); }
317 UNIMPL signalfd
318 UNIMPL timerfd
319 UNIMPL eventfd
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/arch/powerpc/syscalls.master
--- a/sys/compat/linux/arch/powerpc/syscalls.master Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/arch/powerpc/syscalls.master Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.54 2013/08/11 18:34:43 pooka Exp $
+ $NetBSD: syscalls.master,v 1.55 2013/09/24 13:27:50 njoly Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -504,7 +504,8 @@
301 UNIMPL move_pages
302 UNIMPL getcpu
303 UNIMPL epoll_wait
-304 UNIMPL utimensat
+304 STD { int|linux_sys||utimensat(int fd, const char *path, \
+ struct linux_timespec *times, int flag); }
305 UNIMPL signalfd
306 UNIMPL timerfd_create
307 UNIMPL eventfd
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/common/linux_fcntl.h
--- a/sys/compat/linux/common/linux_fcntl.h Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/common/linux_fcntl.h Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_fcntl.h,v 1.14 2008/04/28 20:23:43 martin Exp $ */
+/* $NetBSD: linux_fcntl.h,v 1.15 2013/09/24 13:27:50 njoly Exp $ */
/*-
* Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -43,6 +43,15 @@
#define LINUX_O_RDWR 0x0002
#define LINUX_O_ACCMODE 0x0003
+#define LINUX_AT_FDCWD -100
+#define LINUX_AT_SYMLINK_NOFOLLOW 0x0100
+#define LINUX_AT_REMOVEDIR 0x0200
+#define LINUX_AT_SYMLINK_FOLLOW 0x0400
+#define LINUX_AT_NO_AUTOMOUNT 0x0800
+#define LINUX_AT_EMPTY_PATH 0x1000
+
+int linux_to_bsd_atflags(int);
+
struct linux_flock {
short l_type;
short l_whence;
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/common/linux_file.c
--- a/sys/compat/linux/common/linux_file.c Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/common/linux_file.c Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_file.c,v 1.104 2011/10/14 09:23:28 hannken Exp $ */
+/* $NetBSD: linux_file.c,v 1.105 2013/09/24 13:27:50 njoly Exp $ */
/*-
* Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.104 2011/10/14 09:23:28 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.105 2013/09/24 13:27:50 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -643,6 +643,23 @@
return 0;
}
+
+int
+linux_to_bsd_atflags(int lflags)
+{
+ int bflags = 0;
+
+ if (lflags & LINUX_AT_SYMLINK_NOFOLLOW)
+ bflags |= AT_SYMLINK_NOFOLLOW;
+ if (lflags & LINUX_AT_REMOVEDIR)
+ bflags |= AT_REMOVEDIR;
+ if (lflags & LINUX_AT_SYMLINK_FOLLOW)
+ bflags |= AT_SYMLINK_FOLLOW;
+
+ return bflags;
+}
+
+
#define LINUX_NOT_SUPPORTED(fun) \
int \
fun(struct lwp *l, const struct fun##_args *uap, register_t *retval) \
diff -r a72b8ee47adb -r c6d1fe9568d1 sys/compat/linux/common/linux_misc.c
--- a/sys/compat/linux/common/linux_misc.c Tue Sep 24 02:44:20 2013 +0000
+++ b/sys/compat/linux/common/linux_misc.c Tue Sep 24 13:27:49 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_misc.c,v 1.225 2013/09/15 12:58:34 njoly Exp $ */
+/* $NetBSD: linux_misc.c,v 1.226 2013/09/24 13:27:50 njoly Exp $ */
/*-
* Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.225 2013/09/15 12:58:34 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.226 2013/09/24 13:27:50 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1409,6 +1409,49 @@
tptr, UIO_SYSSPACE);
}
+int
+linux_sys_utimensat(struct lwp *l, const struct linux_sys_utimensat_args *uap,
+ register_t *retval)
+{
+ /* {
+ syscallarg(int) fd;
+ syscallarg(const char *) path;
+ syscallarg(const struct linux_timespec *) times;
+ syscallarg(int) flag;
+ } */
+ int follow, error;
+ struct linux_timespec lts[2];
+ struct timespec *tsp = NULL, ts[2];
+
+ follow = (SCARG(uap, flag) & LINUX_AT_SYMLINK_NOFOLLOW) ?
+ NOFOLLOW : FOLLOW;
+
+ if (SCARG(uap, times)) {
+ error = copyin(SCARG(uap, times), <s, sizeof(lts));
+ if (error != 0)
+ return error;
+ linux_to_native_timespec(&ts[0], <s[0]);
+ linux_to_native_timespec(&ts[1], <s[1]);
+ tsp = ts;
+ }
+
+ if (SCARG(uap, path) == NULL && SCARG(uap, fd) != AT_FDCWD) {
+ file_t *fp;
+
+ /* 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,
+ tsp, UIO_SYSSPACE);
+ fd_putfile(SCARG(uap, fd));
+ return error;
+ }
+
+ return do_sys_utimensat(l, SCARG(uap, fd), NULL,
+ SCARG(uap, path), follow, tsp, UIO_SYSSPACE);
+
+}
+
int linux_sys_lutimes(struct lwp *, const struct linux_sys_utimes_args *, register_t *);
int
linux_sys_lutimes(struct lwp *l, const struct linux_sys_utimes_args *uap, register_t *retval)
Home |
Main Index |
Thread Index |
Old Index