Module Name: src Committed By: pooka Date: Mon Jul 26 11:52:26 UTC 2010
Modified Files: src/sys/rump/include/rump: rump_syscalls_compat.h src/sys/rump/librump/rumpkern: compat.c Log Message: Add select to list on compat syscalls. Makes some code work for me with a nb5 userland without having to compile with -g ;) To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/rump/include/rump/rump_syscalls_compat.h cvs rdiff -u -r1.1 -r1.2 src/sys/rump/librump/rumpkern/compat.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/rump/include/rump/rump_syscalls_compat.h diff -u src/sys/rump/include/rump/rump_syscalls_compat.h:1.2 src/sys/rump/include/rump/rump_syscalls_compat.h:1.3 --- src/sys/rump/include/rump/rump_syscalls_compat.h:1.2 Mon Jul 19 15:38:03 2010 +++ src/sys/rump/include/rump/rump_syscalls_compat.h Mon Jul 26 11:52:25 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_syscalls_compat.h,v 1.2 2010/07/19 15:38:03 pooka Exp $ */ +/* $NetBSD: rump_syscalls_compat.h,v 1.3 2010/07/26 11:52:25 pooka Exp $ */ /*- * Copyright (c) 2010 Antti Kantee. All Rights Reserved. @@ -43,6 +43,7 @@ #define rump_sys_stat(a,b) rump_sys_nb5_stat(a,b) #define rump_sys_lstat(a,b) rump_sys_nb5_lstat(a,b) #define rump_sys_pollts(a,b,c,d) rump_sys_nb5_pollts(a,b,c,d) +#define rump_sys_select(a,b,c,d,e) rump_sys_nb5_select(a,b,c,d,e) #endif /* __NetBSD_Prereq */ #endif /* __NetBSD__ */ #endif /* _KERNEL */ @@ -58,6 +59,7 @@ int rump_sys_nb5_lstat(const char *, struct stat *); int rump_sys_nb5_pollts(struct pollfd *, size_t, const struct timespec *, const void *); +int rump_sys_nb5_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); #ifdef _END_DECLS _END_DECLS Index: src/sys/rump/librump/rumpkern/compat.c diff -u src/sys/rump/librump/rumpkern/compat.c:1.1 src/sys/rump/librump/rumpkern/compat.c:1.2 --- src/sys/rump/librump/rumpkern/compat.c:1.1 Mon Jul 19 15:33:16 2010 +++ src/sys/rump/librump/rumpkern/compat.c Mon Jul 26 11:52:25 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.1 2010/07/19 15:33:16 pooka Exp $ */ +/* $NetBSD: compat.c,v 1.2 2010/07/26 11:52:25 pooka Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -30,12 +30,13 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: compat.c,v 1.1 2010/07/19 15:33:16 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat.c,v 1.2 2010/07/26 11:52:25 pooka Exp $"); #include <sys/param.h> #include <sys/kmem.h> #include <sys/poll.h> #include <sys/sched.h> +#include <sys/select.h> #include <sys/syscallargs.h> #include <sys/vnode.h> @@ -45,7 +46,7 @@ #include <rump/rump_syscalls_compat.h> #include <rump/rumpuser.h> -/* mostly from sys/common/compat/kern_time_50.c */ +/* mostly from sys/compat/common/kern_time_50.c */ int rump_sys_nb5_pollts(struct pollfd *fds, size_t nfds, @@ -84,3 +85,35 @@ return retval; } + +int +rump_sys_nb5_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exfds, + struct timeval *timeout) +{ + register_t retval; + struct timespec ats, *ts = NULL; + struct timeval50 atv50; + int error; + + rump_schedule(); + + if (timeout) { + error = copyin(timeout, &atv50, sizeof(atv50)); + if (error) + return error; + ats.tv_sec = atv50.tv_sec; + ats.tv_nsec = atv50.tv_usec * 1000; + ts = &ats; + } + + error = selcommon(&retval, nfds, readfds, writefds, exfds, ts, NULL); + + rump_unschedule(); + + if (error) { + rumpuser_seterrno(error); + retval = -1; + } + + return retval; +}