Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 Implement pselect(2) and pollts(2).



details:   https://anonhg.NetBSD.org/src/rev/092a6a71e104
branches:  trunk
changeset: 582860:092a6a71e104
user:      cube <cube%NetBSD.org@localhost>
date:      Sat Jul 09 22:40:13 2005 +0000

description:
Implement pselect(2) and pollts(2).

diffstat:

 sys/compat/netbsd32/netbsd32_select.c |  84 ++++++++++++++++++++++++++++++++++-
 sys/compat/netbsd32/syscalls.master   |   7 ++-
 2 files changed, 88 insertions(+), 3 deletions(-)

diffs (127 lines):

diff -r 8b95292d6af0 -r 092a6a71e104 sys/compat/netbsd32/netbsd32_select.c
--- a/sys/compat/netbsd32/netbsd32_select.c     Sat Jul 09 21:58:09 2005 +0000
+++ b/sys/compat/netbsd32/netbsd32_select.c     Sat Jul 09 22:40:13 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_select.c,v 1.6 2005/07/09 21:58:09 cube Exp $ */
+/*     $NetBSD: netbsd32_select.c,v 1.7 2005/07/09 22:40:13 cube Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_select.c,v 1.6 2005/07/09 21:58:09 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_select.c,v 1.7 2005/07/09 22:40:13 cube Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -39,6 +39,7 @@
 #include <sys/vnode.h>
 #include <sys/file.h>
 #include <sys/filedesc.h>
+#include <sys/poll.h>
 #include <sys/select.h>
 
 #include <sys/proc.h>
@@ -76,3 +77,82 @@
            NETBSD32PTR64(SCARG(uap, ou)), NETBSD32PTR64(SCARG(uap, ex)), tv,
            NULL);
 }
+
+int
+netbsd32_pselect(l, v, retval)
+       struct lwp *l;
+       void *v;
+       register_t *retval;
+{
+       struct netbsd32_pselect_args /* {
+               syscallarg(int) nd;
+               syscallarg(netbsd32_fd_setp_t) in;
+               syscallarg(netbsd32_fd_setp_t) ou;
+               syscallarg(netbsd32_fd_setp_t) ex;
+               syscallarg(const netbsd32_timespecp_t) ts;
+               syscallarg(const netbsd32_sigsetp_t) mask;
+       } */ *uap = v;
+       int error;
+       struct netbsd32_timespec ts32;
+       struct timespec ts;
+       struct timeval atv, *tv = NULL;
+       sigset_t amask, *mask = NULL;
+
+       if (SCARG(uap, ts)) {
+               if ((error = copyin(NETBSD32PTR64(SCARG(uap, ts)),
+                   (caddr_t)&ts32, sizeof(ts32))) != 0)
+                       return error;
+               netbsd32_to_timespec(&ts32, &ts);
+               atv.tv_sec = ts.tv_sec;
+               atv.tv_usec = ts.tv_nsec / 1000;
+               tv = &atv;
+       }
+       if (SCARG(uap, mask)) {
+               if ((error = copyin(NETBSD32PTR64(SCARG(uap, mask)),
+                   (caddr_t)&amask, sizeof(amask))) != 0)
+                       return error;
+               mask = &amask;
+       }
+
+       return selcommon(l, retval, SCARG(uap, nd), NETBSD32PTR64(SCARG(uap, in)),
+           NETBSD32PTR64(SCARG(uap, ou)), NETBSD32PTR64(SCARG(uap, ex)), tv,
+           mask);
+}
+
+int
+netbsd32_pollts(l, v, retval)
+       struct lwp *l;
+       void *v;
+       register_t *retval;
+{
+       struct netbsd32_pollts_args /* {
+               syscallarg(struct netbsd32_pollfdp_t) fds;
+               syscallarg(u_int) nfds;
+               syscallarg(const netbsd32_timespecp_t) ts;
+               syscallarg(const netbsd32_sigsetp_t) mask;
+       } */ *uap = v;
+       int error;
+       struct netbsd32_timespec ts32;
+       struct timespec ts;
+       struct timeval atv, *tv = NULL;
+       sigset_t amask, *mask = NULL;
+
+       if (SCARG(uap, ts)) {
+               if ((error = copyin(NETBSD32PTR64(SCARG(uap, ts)),
+                   (caddr_t)&ts32, sizeof(ts32))) != 0)
+                       return error;
+               netbsd32_to_timespec(&ts32, &ts);
+               atv.tv_sec = ts.tv_sec;
+               atv.tv_usec = ts.tv_nsec / 1000;
+               tv = &atv;
+       }
+       if (SCARG(uap, mask)) {
+               if ((error = copyin(NETBSD32PTR64(SCARG(uap, mask)),
+                   (caddr_t)&amask, sizeof(amask))) != 0)
+                       return error;
+               mask = &amask;
+       }
+
+       return pollcommon(l, retval, NETBSD32PTR64(SCARG(uap, fds)),
+           SCARG(uap, nfds), tv, mask);
+}
diff -r 8b95292d6af0 -r 092a6a71e104 sys/compat/netbsd32/syscalls.master
--- a/sys/compat/netbsd32/syscalls.master       Sat Jul 09 21:58:09 2005 +0000
+++ b/sys/compat/netbsd32/syscalls.master       Sat Jul 09 22:40:13 2005 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.30 2005/07/08 22:21:43 cube Exp $
+       $NetBSD: syscalls.master,v 1.31 2005/07/09 22:40:13 cube Exp $
 
 ;      from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
 ;      @(#)syscalls.master     8.2 (Berkeley) 1/13/94
@@ -597,3 +597,8 @@
 372    STD             { int netbsd32_extattr_list_link(const netbsd32_charp path, \
                            int attrnamespace, netbsd32_voidp data, \
                            netbsd32_size_t nbytes); }
+373    STD             { int netbsd32_pselect(int nd, netbsd32_fd_setp_t in, \
+                           netbsd32_fd_setp_t ou, netbsd32_fd_setp_t ex, \
+                           const netbsd32_timespecp_t ts, const netbsd32_sigsetp_t mask); }
+374    STD             { int netbsd32_pollts(netbsd32_pollfdp_t fds, u_int nfds, \
+                           const netbsd32_timespecp_t ts, const netbsd32_sigsetp_t mask); }



Home | Main Index | Thread Index | Old Index