Module Name:    src
Committed By:   pooka
Date:           Mon Jan 17 15:57:04 UTC 2011

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

Log Message:
Put async i/o compat routines in a separate source module from the
ones related to clock and process management.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/compat/common/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/compat/common/kern_select_50.c
cvs rdiff -u -r1.16 -r1.17 src/sys/compat/common/kern_time_50.c
cvs rdiff -u -r1.5 -r1.6 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.45 src/sys/compat/common/Makefile:1.46
--- src/sys/compat/common/Makefile:1.45	Mon Jan 19 19:39:41 2009
+++ src/sys/compat/common/Makefile	Mon Jan 17 15:57:04 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.45 2009/01/19 19:39:41 christos Exp $
+#	$NetBSD: Makefile,v 1.46 2011/01/17 15:57:04 pooka Exp $
 
 LIB=		compat
 NOPIC=		# defined
@@ -40,8 +40,9 @@
 SRCS+=	vfs_syscalls_40.c uipc_syscalls_40.c
 
 # Compatibility code for NetBSD 5.0
-SRCS+=	kern_time_50.c rtsock_50.c sysv_msg_50.c sysv_sem_50.c sysv_shm_50.c \
-	vfs_syscalls_50.c  uipc_syscalls_50.c sysv_ipc_50.c
+SRCS+=	kern_time_50.c kern_select_50.c rtsock_50.c sysv_msg_50.c \
+	sysv_sem_50.c sysv_shm_50.c vfs_syscalls_50.c  uipc_syscalls_50.c \
+	sysv_ipc_50.c
 
 # really, all machines where sizeof(int) != sizeof(long) (LP64)
 .if (${MACHINE_ARCH} != "alpha" && ${MACHINE_ARCH} != "sparc64" \

Index: src/sys/compat/common/kern_time_50.c
diff -u src/sys/compat/common/kern_time_50.c:1.16 src/sys/compat/common/kern_time_50.c:1.17
--- src/sys/compat/common/kern_time_50.c:1.16	Sun May 30 19:31:39 2010
+++ src/sys/compat/common/kern_time_50.c	Mon Jan 17 15:57:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time_50.c,v 1.16 2010/05/30 19:31:39 drochner Exp $	*/
+/*	$NetBSD: kern_time_50.c,v 1.17 2011/01/17 15:57:04 pooka 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.16 2010/05/30 19:31:39 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time_50.c,v 1.17 2011/01/17 15:57:04 pooka Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_aio.h"
@@ -65,46 +65,6 @@
 #include <compat/sys/resource.h>
 #include <compat/sys/clockctl.h>
 
-static int
-compat_50_kevent_fetch_timeout(const void *src, void *dest, size_t length)
-{
-	struct timespec50 ts50;
-	int error;
-
-	KASSERT(length == sizeof(struct timespec));
-
-	error = copyin(src, &ts50, sizeof(ts50));
-	if (error)
-		return error;
-	timespec50_to_timespec(&ts50, (struct timespec *)dest);
-	return 0;
-}
-
-int
-compat_50_sys_kevent(struct lwp *l, const struct compat_50_sys_kevent_args *uap,
-    register_t *retval)
-{
-	/* {
-		syscallarg(int) fd;
-		syscallarg(keventp_t) changelist;
-		syscallarg(size_t) nchanges;
-		syscallarg(keventp_t) eventlist;
-		syscallarg(size_t) nevents;
-		syscallarg(struct timespec50) timeout;
-	} */
-	static const struct kevent_ops compat_50_kevent_ops = {
-		.keo_private = NULL,
-		.keo_fetch_timeout = compat_50_kevent_fetch_timeout,
-		.keo_fetch_changes = kevent_fetch_changes,
-		.keo_put_events = kevent_put_events,
-	};
-
-	return kevent1(retval, SCARG(uap, fd), SCARG(uap, changelist),
-	    SCARG(uap, nchanges), SCARG(uap, eventlist), SCARG(uap, nevents),
-	    (const struct timespec *)(const void *)SCARG(uap, timeout),
-	    &compat_50_kevent_ops);
-}
-
 int
 compat_50_sys_clock_gettime(struct lwp *l,
     const struct compat_50_sys_clock_gettime_args *uap, register_t *retval)
@@ -384,100 +344,6 @@
 }
 
 int
-compat_50_sys_select(struct lwp *l,
-    const struct compat_50_sys_select_args *uap, register_t *retval)
-{
-	/* {
-		syscallarg(int)			nd;
-		syscallarg(fd_set *)		in;
-		syscallarg(fd_set *)		ou;
-		syscallarg(fd_set *)		ex;
-		syscallarg(struct timeval50 *)	tv;
-	} */
-	struct timespec ats, *ts = NULL;
-	struct timeval50 atv50;
-	int error;
-
-	if (SCARG(uap, tv)) {
-		error = copyin(SCARG(uap, tv), (void *)&atv50, sizeof(atv50));
-		if (error)
-			return error;
-		ats.tv_sec = atv50.tv_sec;
-		ats.tv_nsec = atv50.tv_usec * 1000;
-		ts = &ats;
-	}
-
-	return selcommon(retval, SCARG(uap, nd), SCARG(uap, in),
-	    SCARG(uap, ou), SCARG(uap, ex), ts, NULL);
-}
-
-int
-compat_50_sys_pselect(struct lwp *l,
-    const struct compat_50_sys_pselect_args *uap, register_t *retval)
-{
-	/* {
-		syscallarg(int)				nd;
-		syscallarg(fd_set *)			in;
-		syscallarg(fd_set *)			ou;
-		syscallarg(fd_set *)			ex;
-		syscallarg(const struct timespec50 *)	ts;
-		syscallarg(sigset_t *)			mask;
-	} */
-	struct timespec50	ats50;
-	struct timespec	ats, *ts = NULL;
-	sigset_t	amask, *mask = NULL;
-	int		error;
-
-	if (SCARG(uap, ts)) {
-		error = copyin(SCARG(uap, ts), &ats50, sizeof(ats50));
-		if (error)
-			return error;
-		timespec50_to_timespec(&ats50, &ats);
-		ts = &ats;
-	}
-	if (SCARG(uap, mask) != NULL) {
-		error = copyin(SCARG(uap, mask), &amask, sizeof(amask));
-		if (error)
-			return error;
-		mask = &amask;
-	}
-
-	return selcommon(retval, SCARG(uap, nd), SCARG(uap, in),
-	    SCARG(uap, ou), SCARG(uap, ex), ts, mask);
-}
-int
-compat_50_sys_pollts(struct lwp *l, const struct compat_50_sys_pollts_args *uap,
-    register_t *retval)
-{
-	/* {
-		syscallarg(struct pollfd *)		fds;
-		syscallarg(u_int)			nfds;
-		syscallarg(const struct timespec50 *)	ts;
-		syscallarg(const sigset_t *)		mask;
-	} */
-	struct timespec	ats, *ts = NULL;
-	struct timespec50 ats50;
-	sigset_t	amask, *mask = NULL;
-	int		error;
-
-	if (SCARG(uap, ts)) {
-		error = copyin(SCARG(uap, ts), &ats50, sizeof(ats50));
-		if (error)
-			return error;
-		timespec50_to_timespec(&ats50, &ats);
-		ts = &ats;
-	}
-	if (SCARG(uap, mask)) {
-		error = copyin(SCARG(uap, mask), &amask, sizeof(amask));
-		if (error)
-			return error;
-		mask = &amask;
-	}
-
-	return pollcommon(retval, SCARG(uap, fds), SCARG(uap, nfds), ts, mask);
-}
-
-int
 compat_50_sys__lwp_park(struct lwp *l,
     const struct compat_50_sys__lwp_park_args *uap, register_t *retval)
 {

Index: src/sys/modules/compat/Makefile
diff -u src/sys/modules/compat/Makefile:1.5 src/sys/modules/compat/Makefile:1.6
--- src/sys/modules/compat/Makefile:1.5	Mon Jan 19 19:39:41 2009
+++ src/sys/modules/compat/Makefile	Mon Jan 17 15:57:04 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.5 2009/01/19 19:39:41 christos Exp $
+#	$NetBSD: Makefile,v 1.6 2011/01/17 15:57:04 pooka Exp $
 
 .include "../Makefile.inc"
 
@@ -42,8 +42,8 @@
 CPPFLAGS+=	-DSYSVSEM -DSYSVSHM -DSYSVMSG -DCOMPAT_43
 
 SRCS=	kern_exit_43.c kern_info_09.c
-SRCS+=	kern_info_43.c kern_ipc_10.c kern_resource_43.c kern_sig_13.c
-SRCS+=	kern_sig_43.c kern_xxx_12.c sysv_msg_14.c
+SRCS+=	kern_info_43.c kern_ipc_10.c kern_resource_43.c kern_select_50.c
+SRCS+=	kern_sig_13.c kern_sig_43.c kern_xxx_12.c sysv_msg_14.c
 SRCS+=	sysv_sem_14.c sysv_shm_14.c tty_43.c uipc_syscalls_30.c
 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

Added files:

Index: src/sys/compat/common/kern_select_50.c
diff -u /dev/null src/sys/compat/common/kern_select_50.c:1.1
--- /dev/null	Mon Jan 17 15:57:04 2011
+++ src/sys/compat/common/kern_select_50.c	Mon Jan 17 15:57:04 2011
@@ -0,0 +1,176 @@
+/*	$NetBSD: kern_select_50.c,v 1.1 2011/01/17 15:57:04 pooka 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_select_50.c,v 1.1 2011/01/17 15:57:04 pooka Exp $");
+
+#include <sys/param.h>
+#include <sys/event.h>
+#include <sys/poll.h>
+#include <sys/select.h>
+#include <sys/time.h>
+#include <sys/syscallargs.h>
+
+#include <compat/sys/time.h>
+
+static int
+compat_50_kevent_fetch_timeout(const void *src, void *dest, size_t length)
+{
+	struct timespec50 ts50;
+	int error;
+
+	KASSERT(length == sizeof(struct timespec));
+
+	error = copyin(src, &ts50, sizeof(ts50));
+	if (error)
+		return error;
+	timespec50_to_timespec(&ts50, (struct timespec *)dest);
+	return 0;
+}
+
+int
+compat_50_sys_kevent(struct lwp *l, const struct compat_50_sys_kevent_args *uap,
+    register_t *retval)
+{
+	/* {
+		syscallarg(int) fd;
+		syscallarg(keventp_t) changelist;
+		syscallarg(size_t) nchanges;
+		syscallarg(keventp_t) eventlist;
+		syscallarg(size_t) nevents;
+		syscallarg(struct timespec50) timeout;
+	} */
+	static const struct kevent_ops compat_50_kevent_ops = {
+		.keo_private = NULL,
+		.keo_fetch_timeout = compat_50_kevent_fetch_timeout,
+		.keo_fetch_changes = kevent_fetch_changes,
+		.keo_put_events = kevent_put_events,
+	};
+
+	return kevent1(retval, SCARG(uap, fd), SCARG(uap, changelist),
+	    SCARG(uap, nchanges), SCARG(uap, eventlist), SCARG(uap, nevents),
+	    (const struct timespec *)(const void *)SCARG(uap, timeout),
+	    &compat_50_kevent_ops);
+}
+
+int
+compat_50_sys_select(struct lwp *l,
+    const struct compat_50_sys_select_args *uap, register_t *retval)
+{
+	/* {
+		syscallarg(int)			nd;
+		syscallarg(fd_set *)		in;
+		syscallarg(fd_set *)		ou;
+		syscallarg(fd_set *)		ex;
+		syscallarg(struct timeval50 *)	tv;
+	} */
+	struct timespec ats, *ts = NULL;
+	struct timeval50 atv50;
+	int error;
+
+	if (SCARG(uap, tv)) {
+		error = copyin(SCARG(uap, tv), (void *)&atv50, sizeof(atv50));
+		if (error)
+			return error;
+		ats.tv_sec = atv50.tv_sec;
+		ats.tv_nsec = atv50.tv_usec * 1000;
+		ts = &ats;
+	}
+
+	return selcommon(retval, SCARG(uap, nd), SCARG(uap, in),
+	    SCARG(uap, ou), SCARG(uap, ex), ts, NULL);
+}
+
+int
+compat_50_sys_pselect(struct lwp *l,
+    const struct compat_50_sys_pselect_args *uap, register_t *retval)
+{
+	/* {
+		syscallarg(int)				nd;
+		syscallarg(fd_set *)			in;
+		syscallarg(fd_set *)			ou;
+		syscallarg(fd_set *)			ex;
+		syscallarg(const struct timespec50 *)	ts;
+		syscallarg(sigset_t *)			mask;
+	} */
+	struct timespec50	ats50;
+	struct timespec	ats, *ts = NULL;
+	sigset_t	amask, *mask = NULL;
+	int		error;
+
+	if (SCARG(uap, ts)) {
+		error = copyin(SCARG(uap, ts), &ats50, sizeof(ats50));
+		if (error)
+			return error;
+		timespec50_to_timespec(&ats50, &ats);
+		ts = &ats;
+	}
+	if (SCARG(uap, mask) != NULL) {
+		error = copyin(SCARG(uap, mask), &amask, sizeof(amask));
+		if (error)
+			return error;
+		mask = &amask;
+	}
+
+	return selcommon(retval, SCARG(uap, nd), SCARG(uap, in),
+	    SCARG(uap, ou), SCARG(uap, ex), ts, mask);
+}
+
+int
+compat_50_sys_pollts(struct lwp *l, const struct compat_50_sys_pollts_args *uap,
+    register_t *retval)
+{
+	/* {
+		syscallarg(struct pollfd *)		fds;
+		syscallarg(u_int)			nfds;
+		syscallarg(const struct timespec50 *)	ts;
+		syscallarg(const sigset_t *)		mask;
+	} */
+	struct timespec	ats, *ts = NULL;
+	struct timespec50 ats50;
+	sigset_t	amask, *mask = NULL;
+	int		error;
+
+	if (SCARG(uap, ts)) {
+		error = copyin(SCARG(uap, ts), &ats50, sizeof(ats50));
+		if (error)
+			return error;
+		timespec50_to_timespec(&ats50, &ats);
+		ts = &ats;
+	}
+	if (SCARG(uap, mask)) {
+		error = copyin(SCARG(uap, mask), &amask, sizeof(amask));
+		if (error)
+			return error;
+		mask = &amask;
+	}
+
+	return pollcommon(retval, SCARG(uap, fds), SCARG(uap, nfds), ts, mask);
+}

Reply via email to