Module Name: src Committed By: njoly Date: Mon Mar 29 15:34:07 UTC 2010
Modified Files: src/sys/compat/linux/common: linux_time.c src/sys/compat/linux32/common: linux32_time.c src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_time.c Log Message: Convert linux/linux32/netbsd32 clock_settime syscalls, to use the common clock_settime1() function. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/compat/linux/common/linux_time.c cvs rdiff -u -r1.29 -r1.30 src/sys/compat/linux32/common/linux32_time.c cvs rdiff -u -r1.12 -r1.13 src/sys/compat/netbsd32/netbsd32_compat_50.c cvs rdiff -u -r1.38 -r1.39 src/sys/compat/netbsd32/netbsd32_time.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/linux/common/linux_time.c diff -u src/sys/compat/linux/common/linux_time.c:1.29 src/sys/compat/linux/common/linux_time.c:1.30 --- src/sys/compat/linux/common/linux_time.c:1.29 Tue Jul 21 18:42:56 2009 +++ src/sys/compat/linux/common/linux_time.c Mon Mar 29 15:34:07 2010 @@ -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), <s, sizeof lts); if (error != 0) @@ -237,7 +235,7 @@ linux_to_native_timespec(&ts, <s); - return settime(l->l_proc, &ts); + return clock_settime1(l->l_proc, id, &ts, true); } int Index: src/sys/compat/linux32/common/linux32_time.c diff -u src/sys/compat/linux32/common/linux32_time.c:1.29 src/sys/compat/linux32/common/linux32_time.c:1.30 --- src/sys/compat/linux32/common/linux32_time.c:1.29 Tue Jul 21 18:50:43 2009 +++ src/sys/compat/linux32/common/linux32_time.c Mon Mar 29 15:34:07 2010 @@ -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), <s, sizeof lts))) return error; linux32_to_native_timespec(&ts, <s); - return settime(l->l_proc, &ts); + return clock_settime1(l->l_proc, id, &ts, true); } int Index: src/sys/compat/netbsd32/netbsd32_compat_50.c diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.12 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.13 --- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.12 Mon Mar 29 11:39:45 2010 +++ src/sys/compat/netbsd32/netbsd32_compat_50.c Mon Mar 29 15:34:07 2010 @@ -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 Index: src/sys/compat/netbsd32/netbsd32_time.c diff -u src/sys/compat/netbsd32/netbsd32_time.c:1.38 src/sys/compat/netbsd32/netbsd32_time.c:1.39 --- src/sys/compat/netbsd32/netbsd32_time.c:1.38 Mon Mar 29 11:39:45 2010 +++ src/sys/compat/netbsd32/netbsd32_time.c Mon Mar 29 15:34:07 2010 @@ -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