Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump Add select to list on compat syscalls. Makes some ...



details:   https://anonhg.NetBSD.org/src/rev/2e1d31657ff9
branches:  trunk
changeset: 756608:2e1d31657ff9
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Jul 26 11:52:25 2010 +0000

description:
Add select to list on compat syscalls.  Makes some code work for
me with a nb5 userland without having to compile with -g ;)

diffstat:

 sys/rump/include/rump/rump_syscalls_compat.h |   4 ++-
 sys/rump/librump/rumpkern/compat.c           |  39 +++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)

diffs (94 lines):

diff -r 921bbe8496c4 -r 2e1d31657ff9 sys/rump/include/rump/rump_syscalls_compat.h
--- a/sys/rump/include/rump/rump_syscalls_compat.h      Mon Jul 26 06:40:38 2010 +0000
+++ b/sys/rump/include/rump/rump_syscalls_compat.h      Mon Jul 26 11:52:25 2010 +0000
@@ -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
diff -r 921bbe8496c4 -r 2e1d31657ff9 sys/rump/librump/rumpkern/compat.c
--- a/sys/rump/librump/rumpkern/compat.c        Mon Jul 26 06:40:38 2010 +0000
+++ b/sys/rump/librump/rumpkern/compat.c        Mon Jul 26 11:52:25 2010 +0000
@@ -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;
+}



Home | Main Index | Thread Index | Old Index