Module Name:    src
Committed By:   njoly
Date:           Fri Apr  4 18:17:36 UTC 2014

Modified Files:
        src/sys/compat/common: Makefile kern_time_50.c
        src/sys/modules/compat: Makefile
Added Files:
        src/sys/compat/common: kern_50.c

Log Message:
Move a few compat 50 syscalls, not applicable to rump kernels, out of
kern_time_50.c to a new source module.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/compat/common/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/compat/common/kern_50.c
cvs rdiff -u -r1.26 -r1.27 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.9 -r1.10 src/sys/modules/compat/Makefile

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/common/Makefile
diff -u src/sys/compat/common/Makefile:1.51 src/sys/compat/common/Makefile:1.52
--- src/sys/compat/common/Makefile:1.51	Fri Mar 29 01:02:49 2013
+++ src/sys/compat/common/Makefile	Fri Apr  4 18:17:36 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.51 2013/03/29 01:02:49 christos Exp $
+#	$NetBSD: Makefile,v 1.52 2014/04/04 18:17:36 njoly Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -40,7 +40,7 @@ SRCS+=	kern_time_30.c vfs_syscalls_30.c 
 SRCS+=	vfs_syscalls_40.c uipc_syscalls_40.c
 
 # Compatibility code for NetBSD 5.0
-SRCS+=	kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
+SRCS+=	kern_50.c kern_time_50.c kern_select_50.c rndpseudo_50.c rtsock_50.c \
 	sysv_ipc_50.c sysv_msg_50.c sysv_sem_50.c sysv_shm_50.c \
 	vfs_syscalls_50.c  uipc_syscalls_50.c
 

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.26 src/sys/compat/common/kern_time_50.c:1.27
--- src/sys/compat/common/kern_time_50.c:1.26	Fri Mar 29 01:02:49 2013
+++ src/sys/compat/common/kern_time_50.c	Fri Apr  4 18:17:36 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.26 2013/03/29 01:02:49 christos Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.27 2014/04/04 18:17:36 njoly 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.26 2013/03/29 01:02:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.27 2014/04/04 18:17:36 njoly Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -350,39 +350,6 @@ out:
 }
 
 int
-compat_50_sys__lwp_park(struct lwp *l,
-    const struct compat_50_sys__lwp_park_args *uap, register_t *retval)
-{
-	/* {
-		syscallarg(const struct timespec50 *)	ts;
-		syscallarg(lwpid_t)			unpark;
-		syscallarg(const void *)		hint;
-		syscallarg(const void *)		unparkhint;
-	} */
-	struct timespec ts, *tsp;
-	struct timespec50 ts50;
-	int error;
-
-	if (SCARG(uap, ts) == NULL)
-		tsp = NULL;
-	else {
-		error = copyin(SCARG(uap, ts), &ts50, sizeof(ts50));
-		if (error != 0)
-			return error;
-		timespec50_to_timespec(&ts50, &ts);
-		tsp = &ts;
-	}
-
-	if (SCARG(uap, unpark) != 0) {
-		error = lwp_unpark(SCARG(uap, unpark), SCARG(uap, unparkhint));
-		if (error != 0)
-			return error;
-	}
-
-	return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp, SCARG(uap, hint));
-}
-
-int
 compat_50_sys_mq_timedsend(struct lwp *l,
     const struct compat_50_sys_mq_timedsend_args *uap, register_t *retval)
 {
@@ -456,44 +423,6 @@ compat_50_sys_mq_timedreceive(struct lwp
 #endif
 }
 
-static int
-tscopyin(const void *u, void *s, size_t len)
-{
-	struct timespec50 ts50;
-	int error;
-
-	KASSERT(len == sizeof(struct timespec));
-	error = copyin(u, &ts50, sizeof(ts50));
-	if (error)
-		return error;
-	timespec50_to_timespec(&ts50, s);
-	return 0;
-}
-
-static int
-tscopyout(const void *s, void *u, size_t len)
-{
-	struct timespec50 ts50;
-
-	KASSERT(len == sizeof(struct timespec));
-	timespec_to_timespec50(s, &ts50);
-	return copyout(&ts50, u, sizeof(ts50));
-}
-
-int
-compat_50_sys___sigtimedwait(struct lwp *l,
-    const struct compat_50_sys___sigtimedwait_args *uap, register_t *retval)
-{
-	int res;
-
-	res = sigtimedwait1(l,
-	    (const struct sys_____sigtimedwait50_args *)uap, retval, copyin,
-	    copyout, tscopyin, tscopyout);
-	if (!res)
-		*retval = 0; /* XXX NetBSD<=5 was not POSIX compliant */
-	return res;
-}
-
 void
 rusage_to_rusage50(const struct rusage *ru, struct rusage50 *ru50)
 {
@@ -679,37 +608,6 @@ compat50_clockctlioctl(dev_t dev, u_long
 
 	return (error);
 }
-int
-compat_50_sys_wait4(struct lwp *l, const struct compat_50_sys_wait4_args *uap,
-    register_t *retval)
-{
-	/* {
-		syscallarg(int)			pid;
-		syscallarg(int *)		status;
-		syscallarg(int)			options;
-		syscallarg(struct rusage50 *)	rusage;
-	} */
-	int status, error, pid = SCARG(uap, pid);
-	struct rusage50 ru50;
-	struct rusage ru;
-
-	error = do_sys_wait(&pid, &status, SCARG(uap, options),
-	    SCARG(uap, rusage) != NULL ? &ru : NULL);
-
-	retval[0] = pid;
-	if (pid == 0)
-		return error;
-
-	if (SCARG(uap, rusage)) {
-		rusage_to_rusage50(&ru, &ru50);
-		error = copyout(&ru50, SCARG(uap, rusage), sizeof(ru50));
-	}
-
-	if (error == 0 && SCARG(uap, status))
-		error = copyout(&status, SCARG(uap, status), sizeof(status));
-
-	return error;
-}
 
 void
 compat_sysctl_time(struct sysctllog **clog)

Index: src/sys/modules/compat/Makefile
diff -u src/sys/modules/compat/Makefile:1.9 src/sys/modules/compat/Makefile:1.10
--- src/sys/modules/compat/Makefile:1.9	Tue Apr 16 15:30:09 2013
+++ src/sys/modules/compat/Makefile	Fri Apr  4 18:17:36 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2013/04/16 15:30:09 christos Exp $
+#	$NetBSD: Makefile,v 1.10 2014/04/04 18:17:36 njoly Exp $
 
 .include "../Makefile.inc"
 
@@ -34,7 +34,7 @@ SRCS+=	sysv_sem_14.c sysv_shm_14.c tty_4
 SRCS+=	uipc_syscalls_43.c vfs_syscalls_12.c kern_sig_16.c
 SRCS+=	vfs_syscalls_20.c vfs_syscalls_30.c vfs_syscalls_40.c
 SRCS+=	vfs_syscalls_43.c vm_12.c vm_43.c compat_mod.c
-SRCS+=	sysv_msg_50.c sysv_sem_50.c kern_time_50.c
+SRCS+=	sysv_msg_50.c sysv_sem_50.c kern_time_50.c kern_50.c
 SRCS+=	sysv_shm_50.c vfs_syscalls_50.c sysv_ipc_50.c
 SRCS+=	tty_60.c kern_time_60.c
 

Added files:

Index: src/sys/compat/common/kern_50.c
diff -u /dev/null src/sys/compat/common/kern_50.c:1.1
--- /dev/null	Fri Apr  4 18:17:36 2014
+++ src/sys/compat/common/kern_50.c	Fri Apr  4 18:17:36 2014
@@ -0,0 +1,143 @@
+/*	$NetBSD: kern_50.c,v 1.1 2014/04/04 18:17:36 njoly Exp $	*/
+
+/*-
+ * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <sys/cdefs.h>
+__KERNEL_RCSID(0, "$NetBSD: kern_50.c,v 1.1 2014/04/04 18:17:36 njoly Exp $");
+
+#include <sys/param.h>
+#include <sys/lwp.h>
+#include <sys/proc.h>
+#include <sys/syscallargs.h>
+
+#include <compat/sys/resource.h>
+#include <compat/sys/time.h>
+
+int
+compat_50_sys__lwp_park(struct lwp *l,
+    const struct compat_50_sys__lwp_park_args *uap, register_t *retval)
+{
+	/* {
+		syscallarg(const struct timespec50 *)	ts;
+		syscallarg(lwpid_t)			unpark;
+		syscallarg(const void *)		hint;
+		syscallarg(const void *)		unparkhint;
+	} */
+	struct timespec ts, *tsp;
+	struct timespec50 ts50;
+	int error;
+
+	if (SCARG(uap, ts) == NULL)
+		tsp = NULL;
+	else {
+		error = copyin(SCARG(uap, ts), &ts50, sizeof(ts50));
+		if (error != 0)
+			return error;
+		timespec50_to_timespec(&ts50, &ts);
+		tsp = &ts;
+	}
+
+	if (SCARG(uap, unpark) != 0) {
+		error = lwp_unpark(SCARG(uap, unpark), SCARG(uap, unparkhint));
+		if (error != 0)
+			return error;
+	}
+
+	return lwp_park(CLOCK_REALTIME, TIMER_ABSTIME, tsp, SCARG(uap, hint));
+}
+
+static int
+tscopyin(const void *u, void *s, size_t len)
+{
+	struct timespec50 ts50;
+	int error;
+
+	KASSERT(len == sizeof(struct timespec));
+	error = copyin(u, &ts50, sizeof(ts50));
+	if (error)
+		return error;
+	timespec50_to_timespec(&ts50, s);
+	return 0;
+}
+
+static int
+tscopyout(const void *s, void *u, size_t len)
+{
+	struct timespec50 ts50;
+
+	KASSERT(len == sizeof(struct timespec));
+	timespec_to_timespec50(s, &ts50);
+	return copyout(&ts50, u, sizeof(ts50));
+}
+
+int
+compat_50_sys___sigtimedwait(struct lwp *l,
+    const struct compat_50_sys___sigtimedwait_args *uap, register_t *retval)
+{
+	int res;
+
+	res = sigtimedwait1(l,
+	    (const struct sys_____sigtimedwait50_args *)uap, retval, copyin,
+	    copyout, tscopyin, tscopyout);
+	if (!res)
+		*retval = 0; /* XXX NetBSD<=5 was not POSIX compliant */
+	return res;
+}
+
+int
+compat_50_sys_wait4(struct lwp *l, const struct compat_50_sys_wait4_args *uap,
+    register_t *retval)
+{
+	/* {
+		syscallarg(int)			pid;
+		syscallarg(int *)		status;
+		syscallarg(int)			options;
+		syscallarg(struct rusage50 *)	rusage;
+	} */
+	int status, error, pid = SCARG(uap, pid);
+	struct rusage50 ru50;
+	struct rusage ru;
+
+	error = do_sys_wait(&pid, &status, SCARG(uap, options),
+	    SCARG(uap, rusage) != NULL ? &ru : NULL);
+
+	retval[0] = pid;
+	if (pid == 0)
+		return error;
+
+	if (SCARG(uap, rusage)) {
+		rusage_to_rusage50(&ru, &ru50);
+		error = copyout(&ru50, SCARG(uap, rusage), sizeof(ru50));
+	}
+
+	if (error == 0 && SCARG(uap, status))
+		error = copyout(&status, SCARG(uap, status), sizeof(status));
+
+	return error;
+}

Reply via email to