Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys kernel portion of clock_nanosleep()
details: https://anonhg.NetBSD.org/src/rev/eaa6bb9e6803
branches: trunk
changeset: 781804:eaa6bb9e6803
user: christos <christos%NetBSD.org@localhost>
date: Tue Oct 02 01:44:27 2012 +0000
description:
kernel portion of clock_nanosleep()
diffstat:
sys/compat/common/kern_time_50.c | 7 ++--
sys/compat/ibcs2/ibcs2_misc.c | 6 ++--
sys/compat/linux/common/linux_time.c | 15 +++++----
sys/compat/linux32/common/linux32_time.c | 15 +++++----
sys/compat/netbsd32/netbsd32_compat_50.c | 7 ++--
sys/compat/netbsd32/netbsd32_time.c | 37 ++++++++++++++++++++++--
sys/compat/netbsd32/syscalls.master | 11 ++++++-
sys/kern/kern_time.c | 48 +++++++++++++++++++++++++++----
sys/kern/syscalls.master | 5 ++-
sys/sys/param.h | 4 +-
sys/sys/timevar.h | 5 ++-
11 files changed, 120 insertions(+), 40 deletions(-)
diffs (truncated from 419 to 300 lines):
diff -r 20eb471f336a -r eaa6bb9e6803 sys/compat/common/kern_time_50.c
--- a/sys/compat/common/kern_time_50.c Tue Oct 02 01:42:06 2012 +0000
+++ b/sys/compat/common/kern_time_50.c Tue Oct 02 01:44:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $ */
+/* $NetBSD: kern_time_50.c,v 1.23 2012/10/02 01:44:27 christos Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.22 2012/01/04 14:31:17 apb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.23 2012/10/02 01:44:27 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_aio.h"
@@ -152,7 +152,8 @@
return error;
timespec50_to_timespec(&rqt50, &rqt);
- error = nanosleep1(l, &rqt, SCARG(uap, rmtp) ? &rmt : NULL);
+ error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqt,
+ SCARG(uap, rmtp) ? &rmt : NULL);
if (SCARG(uap, rmtp) == NULL || (error != 0 && error != EINTR))
return error;
diff -r 20eb471f336a -r eaa6bb9e6803 sys/compat/ibcs2/ibcs2_misc.c
--- a/sys/compat/ibcs2/ibcs2_misc.c Tue Oct 02 01:42:06 2012 +0000
+++ b/sys/compat/ibcs2/ibcs2_misc.c Tue Oct 02 01:44:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_misc.c,v 1.111 2010/06/24 13:03:06 hannken Exp $ */
+/* $NetBSD: ibcs2_misc.c,v 1.112 2012/10/02 01:44:27 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.111 2010/06/24 13:03:06 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_misc.c,v 1.112 2012/10/02 01:44:27 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1254,7 +1254,7 @@
rqt.tv_sec = 0;
rqt.tv_nsec = SCARG(uap, millisec) * 1000;
- error = nanosleep1(l, &rqt, &rmt);
+ error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqt, &rmt);
/* If interrupted we can either report EINTR, or the time left */
if (error != 0 && error != EINTR)
return error;
diff -r 20eb471f336a -r eaa6bb9e6803 sys/compat/linux/common/linux_time.c
--- a/sys/compat/linux/common/linux_time.c Tue Oct 02 01:42:06 2012 +0000
+++ b/sys/compat/linux/common/linux_time.c Tue Oct 02 01:44:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux_time.c,v 1.35 2011/11/18 04:07:44 christos Exp $ */
+/* $NetBSD: linux_time.c,v 1.36 2012/10/02 01:44:28 christos 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.35 2011/11/18 04:07:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_time.c,v 1.36 2012/10/02 01:44:28 christos Exp $");
#include <sys/param.h>
#include <sys/ucred.h>
@@ -155,7 +155,8 @@
return error;
linux_to_native_timespec(&rqts, &lrqts);
- error = nanosleep1(l, &rqts, SCARG(uap, rmtp) ? &rmts : NULL);
+ error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqts,
+ SCARG(uap, rmtp) ? &rmts : NULL);
if (SCARG(uap, rmtp) == NULL || (error != 0 && error != EINTR))
return error;
@@ -269,11 +270,10 @@
} */
struct linux_timespec lrqts, lrmts;
struct timespec rqts, rmts;
- int error, error1;
+ int error, error1, flags;
clockid_t nwhich;
- if (SCARG(uap, flags) != 0)
- return EINVAL; /* XXX deal with TIMER_ABSTIME */
+ flags = SCARG(uap, flags) != 0 ? TIMER_ABSTIME : 0;
error = linux_to_native_clockid(&nwhich, SCARG(uap, which));
if (error != 0)
@@ -285,7 +285,8 @@
linux_to_native_timespec(&rqts, &lrqts);
- error = nanosleep1(l, &rqts, SCARG(uap, rmtp) ? &rmts : NULL);
+ error = nanosleep1(l, nwhich, flags, &rqts,
+ SCARG(uap, rmtp) ? &rmts : NULL);
if (SCARG(uap, rmtp) == NULL || (error != 0 && error != EINTR))
return error;
diff -r 20eb471f336a -r eaa6bb9e6803 sys/compat/linux32/common/linux32_time.c
--- a/sys/compat/linux32/common/linux32_time.c Tue Oct 02 01:42:06 2012 +0000
+++ b/sys/compat/linux32/common/linux32_time.c Tue Oct 02 01:44:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: linux32_time.c,v 1.36 2011/11/18 04:08:56 christos Exp $ */
+/* $NetBSD: linux32_time.c,v 1.37 2012/10/02 01:44:28 christos 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.36 2011/11/18 04:08:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_time.c,v 1.37 2012/10/02 01:44:28 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -265,7 +265,8 @@
return error;
linux32_to_native_timespec(&rqts, &lrqts);
- error = nanosleep1(l, &rqts, SCARG_P32(uap, rmtp) ? &rmts : NULL);
+ error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqts,
+ SCARG_P32(uap, rmtp) ? &rmts : NULL);
if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR))
return error;
@@ -360,11 +361,10 @@
} */
struct linux32_timespec lrqts, lrmts;
struct timespec rqts, rmts;
- int error, error1;
+ int error, error1, flags;
clockid_t id;
- if (SCARG(uap, flags) != 0)
- return EINVAL; /* XXX deal with TIMER_ABSTIME */
+ flags = SCARG(uap, flags) != 0 ? TIMER_ABSTIME : 0;
error = linux_to_native_clockid(&id, SCARG(uap, which));
if (error != 0)
@@ -375,7 +375,8 @@
return error;
linux32_to_native_timespec(&rqts, &lrqts);
- error = nanosleep1(l, &rqts, SCARG_P32(uap, rmtp) ? &rmts : NULL);
+ error = nanosleep1(l, id, flags, &rqts,
+ SCARG_P32(uap, rmtp) ? &rmts : NULL);
if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR))
return error;
diff -r 20eb471f336a -r eaa6bb9e6803 sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c Tue Oct 02 01:42:06 2012 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c Tue Oct 02 01:44:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50.c,v 1.20 2011/11/18 03:34:13 christos Exp $ */
+/* $NetBSD: netbsd32_compat_50.c,v 1.21 2012/10/02 01:44:28 christos 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.20 2011/11/18 03:34:13 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.21 2012/10/02 01:44:28 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -438,7 +438,8 @@
return (error);
netbsd32_to_timespec50(&ts32, &rqt);
- error = nanosleep1(l, &rqt, SCARG_P32(uap, rmtp) ? &rmt : NULL);
+ error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqt,
+ SCARG_P32(uap, rmtp) ? &rmt : NULL);
if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR))
return error;
diff -r 20eb471f336a -r eaa6bb9e6803 sys/compat/netbsd32/netbsd32_time.c
--- a/sys/compat/netbsd32/netbsd32_time.c Tue Oct 02 01:42:06 2012 +0000
+++ b/sys/compat/netbsd32/netbsd32_time.c Tue Oct 02 01:44:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_time.c,v 1.41 2010/04/08 11:51:14 njoly Exp $ */
+/* $NetBSD: netbsd32_time.c,v 1.42 2012/10/02 01:44:28 christos 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.41 2010/04/08 11:51:14 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_time.c,v 1.42 2012/10/02 01:44:28 christos Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ntp.h"
@@ -422,12 +422,41 @@
return (error);
netbsd32_to_timespec(&ts32, &rqt);
- error = nanosleep1(l, &rqt, SCARG_P32(uap, rmtp) ? &rmt : NULL);
+ error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqt,
+ SCARG_P32(uap, rmtp) ? &rmt : NULL);
if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR))
return error;
netbsd32_from_timespec(&rmt, &ts32);
- error1 = copyout(&ts32, SCARG_P32(uap,rmtp), sizeof(ts32));
+ error1 = copyout(&ts32, SCARG_P32(uap, rmtp), sizeof(ts32));
+ return error1 ? error1 : error;
+}
+
+int
+netbsd32_clock_nanosleep(struct lwp *l, const struct netbsd32_clock_nanosleep_args *uap, register_t *retval)
+{
+ /* {
+ clockid_t clock_id;
+ int flags;
+ syscallarg(const netbsd32_timespecp_t) rqtp;
+ syscallarg(netbsd32_timespecp_t) rmtp;
+ } */
+ struct netbsd32_timespec ts32;
+ struct timespec rqt, rmt;
+ int error, error1;
+
+ error = copyin(SCARG_P32(uap, rqtp), &ts32, sizeof(ts32));
+ if (error)
+ return (error);
+ netbsd32_to_timespec(&ts32, &rqt);
+
+ error = nanosleep1(l, SCARG(uap, clock_id), SCARG(uap, flags),
+ &rqt, SCARG_P32(uap, rmtp) ? &rmt : NULL);
+ if (SCARG_P32(uap, rmtp) == NULL || (error != 0 && error != EINTR))
+ return error;
+
+ netbsd32_from_timespec(&rmt, &ts32);
+ error1 = copyout(&ts32, SCARG_P32(uap, rmtp), sizeof(ts32));
return error1 ? error1 : error;
}
diff -r 20eb471f336a -r eaa6bb9e6803 sys/compat/netbsd32/syscalls.master
--- a/sys/compat/netbsd32/syscalls.master Tue Oct 02 01:42:06 2012 +0000
+++ b/sys/compat/netbsd32/syscalls.master Tue Oct 02 01:44:27 2012 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.95 2012/04/08 11:27:44 martin Exp $
+ $NetBSD: syscalls.master,v 1.96 2012/10/02 01:44:28 christos Exp $
; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -1030,3 +1030,12 @@
const netbsd32_posix_spawnattrp attrp, \
netbsd32_charpp argv, netbsd32_charpp envp); }
+475 UNIMPL { int|netbsd32||recvmmsg(int s, struct mmsghdr *mmsg, \
+ unsigned int vlen, unsigned int flags, \
+ netbsd32_timespecp_t timeout); }
+476 UNIMPL { int|netbsd32||sendmmsg(int s, struct mmsghdr *mmsg, \
+ unsigned int vlen, unsigned int flags); }
+477 STD { int|netbsd32||clock_nanosleep(\
+ netbsd32_clockid_t clock_id, \
+ int flags, const netbsd32_timespecp_t rqtp, \
+ netbsd32_timespecp_t rmtp); }
diff -r 20eb471f336a -r eaa6bb9e6803 sys/kern/kern_time.c
--- a/sys/kern/kern_time.c Tue Oct 02 01:42:06 2012 +0000
+++ b/sys/kern/kern_time.c Tue Oct 02 01:44:27 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_time.c,v 1.174 2012/03/22 17:46:07 dholland Exp $ */
+/* $NetBSD: kern_time.c,v 1.175 2012/10/02 01:44:28 christos Exp $ */
/*-
* Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.174 2012/03/22 17:46:07 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.175 2012/10/02 01:44:28 christos Exp $");
#include <sys/param.h>
#include <sys/resourcevar.h>
@@ -303,7 +303,35 @@
if (error)
return (error);
- error = nanosleep1(l, &rqt, SCARG(uap, rmtp) ? &rmt : NULL);
+ error = nanosleep1(l, CLOCK_MONOTONIC, 0, &rqt,
+ SCARG(uap, rmtp) ? &rmt : NULL);
+ if (SCARG(uap, rmtp) == NULL || (error != 0 && error != EINTR))
+ return error;
+
+ error1 = copyout(&rmt, SCARG(uap, rmtp), sizeof(rmt));
Home |
Main Index |
Thread Index |
Old Index