Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat Convert linux/linux32/netbsd32 clock_settime sysc...



details:   https://anonhg.NetBSD.org/src/rev/260517e7468b
branches:  trunk
changeset: 753463:260517e7468b
user:      njoly <njoly%NetBSD.org@localhost>
date:      Mon Mar 29 15:34:07 2010 +0000

description:
Convert linux/linux32/netbsd32 clock_settime syscalls, to use the
common clock_settime1() function.

diffstat:

 sys/compat/linux/common/linux_time.c     |  16 +++++++---------
 sys/compat/linux32/common/linux32_time.c |  16 +++++++---------
 sys/compat/netbsd32/netbsd32_compat_50.c |  11 +++--------
 sys/compat/netbsd32/netbsd32_time.c      |  11 +++--------
 4 files changed, 20 insertions(+), 34 deletions(-)

diffs (167 lines):

diff -r a92b0305bc92 -r 260517e7468b sys/compat/linux/common/linux_time.c
--- a/sys/compat/linux/common/linux_time.c      Mon Mar 29 13:41:06 2010 +0000
+++ b/sys/compat/linux/common/linux_time.c      Mon Mar 29 15:34:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_time.c,v 1.29 2009/07/21 18:42:56 njoly Exp $ */
+/*     $NetBSD: linux_time.c,v 1.30 2010/03/29 15:34:07 njoly Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.29 2009/07/21 18:42:56 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.30 2010/03/29 15:34:07 njoly Exp $");
 
 #include <sys/param.h>
 #include <sys/ucred.h>
@@ -222,14 +222,12 @@
        } */
        struct timespec ts;
        struct linux_timespec lts;
+       clockid_t id;
        int error;
 
-       switch (SCARG(uap, which)) {
-       case LINUX_CLOCK_REALTIME:
-               break;
-       default:
-               return EINVAL;
-       }
+       error = linux_to_native_clockid(&id, SCARG(uap, which));
+       if (error != 0)
+               return error;
 
        error = copyin(SCARG(uap, tp), &lts, sizeof lts);
        if (error != 0)
@@ -237,7 +235,7 @@
 
        linux_to_native_timespec(&ts, &lts);
 
-       return settime(l->l_proc, &ts);
+       return clock_settime1(l->l_proc, id, &ts, true);
 }
 
 int
diff -r a92b0305bc92 -r 260517e7468b sys/compat/linux32/common/linux32_time.c
--- a/sys/compat/linux32/common/linux32_time.c  Mon Mar 29 13:41:06 2010 +0000
+++ b/sys/compat/linux32/common/linux32_time.c  Mon Mar 29 15:34:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux32_time.c,v 1.29 2009/07/21 18:50:43 njoly Exp $ */
+/*     $NetBSD: linux32_time.c,v 1.30 2010/03/29 15:34:07 njoly Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.29 2009/07/21 18:50:43 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.30 2010/03/29 15:34:07 njoly Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -287,19 +287,17 @@
        int error;
        struct timespec ts;
        struct linux32_timespec lts;
+       clockid_t id;
 
-       switch (SCARG(uap, which)) {
-       case LINUX_CLOCK_REALTIME:
-               break;
-       default:
-               return EINVAL;
-       }
+       error = linux_to_native_clockid(&id, SCARG(uap, which));
+       if (error != 0)
+               return error;
 
        if ((error = copyin(SCARG_P32(uap, tp), &lts, sizeof lts)))
                return error;
 
        linux32_to_native_timespec(&ts, &lts);
-       return settime(l->l_proc, &ts);
+       return clock_settime1(l->l_proc, id, &ts, true);
 }
 
 int
diff -r a92b0305bc92 -r 260517e7468b sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c  Mon Mar 29 13:41:06 2010 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c  Mon Mar 29 15:34:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_compat_50.c,v 1.12 2010/03/29 11:39:45 njoly Exp $    */
+/*     $NetBSD: netbsd32_compat_50.c,v 1.13 2010/03/29 15:34:07 njoly Exp $    */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.12 2010/03/29 11:39:45 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.13 2010/03/29 15:34:07 njoly Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sysv.h"
@@ -335,19 +335,14 @@
                syscallarg(const netbsd32_timespec50p_t) tp;
        } */
        struct netbsd32_timespec50 ts32;
-       clockid_t clock_id;
        struct timespec ats;
        int error;
 
-       clock_id = SCARG(uap, clock_id);
-       if (clock_id != CLOCK_REALTIME)
-               return (EINVAL);
-
        if ((error = copyin(SCARG_P32(uap, tp), &ts32, sizeof(ts32))) != 0)
                return (error);
 
        netbsd32_to_timespec50(&ts32, &ats);
-       return settime(l->l_proc, &ats);
+       return clock_settime1(l->l_proc, SCARG(uap, clock_id), &ats, true);
 }
 
 int
diff -r a92b0305bc92 -r 260517e7468b sys/compat/netbsd32/netbsd32_time.c
--- a/sys/compat/netbsd32/netbsd32_time.c       Mon Mar 29 13:41:06 2010 +0000
+++ b/sys/compat/netbsd32/netbsd32_time.c       Mon Mar 29 15:34:07 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_time.c,v 1.38 2010/03/29 11:39:45 njoly Exp $ */
+/*     $NetBSD: netbsd32_time.c,v 1.39 2010/03/29 15:34:07 njoly Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.38 2010/03/29 11:39:45 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.39 2010/03/29 15:34:07 njoly Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -376,19 +376,14 @@
                syscallarg(const netbsd32_timespecp_t) tp;
        } */
        struct netbsd32_timespec ts32;
-       clockid_t clock_id;
        struct timespec ats;
        int error;
 
-       clock_id = SCARG(uap, clock_id);
-       if (clock_id != CLOCK_REALTIME)
-               return (EINVAL);
-
        if ((error = copyin(SCARG_P32(uap, tp), &ts32, sizeof(ts32))) != 0)
                return (error);
 
        netbsd32_to_timespec(&ts32, &ats);
-       return settime(l->l_proc, &ats);
+       return clock_settime1(l->l_proc, SCARG(uap, clock_id), &ats, true);
 }
 
 int



Home | Main Index | Thread Index | Old Index