Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/osf1 emulate select(), to get the timeval right.



details:   https://anonhg.NetBSD.org/src/rev/5df28daaf9b1
branches:  trunk
changeset: 472351:5df28daaf9b1
user:      cgd <cgd%NetBSD.org@localhost>
date:      Wed Apr 28 02:34:25 1999 +0000

description:
emulate select(), to get the timeval right.
And CGD said, "Let there be eyes!"  And there were eyes, and it was good.

diffstat:

 sys/compat/osf1/osf1_misc.c     |  48 ++++++++++++++++++++++++++++++++++++++++-
 sys/compat/osf1/syscalls.master |   6 ++--
 2 files changed, 50 insertions(+), 4 deletions(-)

diffs (79 lines):

diff -r 942c2f512752 -r 5df28daaf9b1 sys/compat/osf1/osf1_misc.c
--- a/sys/compat/osf1/osf1_misc.c       Wed Apr 28 02:16:07 1999 +0000
+++ b/sys/compat/osf1/osf1_misc.c       Wed Apr 28 02:34:25 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_misc.c,v 1.29 1999/04/28 02:02:50 cgd Exp $ */
+/* $NetBSD: osf1_misc.c,v 1.30 1999/04/28 02:34:25 cgd Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -1247,3 +1247,49 @@
        }
        return (error);
 }
+
+int
+osf1_sys_select(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct osf1_sys_select_args *uap = v;
+       struct sys_select_args a;
+       struct osf1_timeval otv;
+       struct timeval tv;
+       int error;
+       caddr_t sg;
+
+       SCARG(&a, nd) = SCARG(uap, nd);
+       SCARG(&a, in) = SCARG(uap, in);
+       SCARG(&a, ou) = SCARG(uap, ou);
+       SCARG(&a, ex) = SCARG(uap, ex);
+
+       error = 0;
+       if (SCARG(uap, tv) == NULL)
+               SCARG(&a, tv) = NULL;
+       else {
+               sg = stackgap_init(p->p_emul);
+               SCARG(&a, tv) = stackgap_alloc(&sg, sizeof tv);
+
+               /* get the OSF/1 timeval argument */
+               error = copyin((caddr_t)SCARG(uap, tv),
+                   (caddr_t)&otv, sizeof otv);
+               if (error == 0) {
+
+                       /* fill in and copy out the BSD timeval argument */
+                       memset(&tv, 0, sizeof tv);
+                       tv.tv_sec = otv.tv_sec;
+                       tv.tv_usec = otv.tv_usec;
+
+                       error = copyout((caddr_t)&tv,
+                           (caddr_t)SCARG(&a, tv), sizeof tv);
+               }
+       }
+
+       if (error == 0)
+               error = sys_select(p, &a, retval);
+
+       return (error);
+}
diff -r 942c2f512752 -r 5df28daaf9b1 sys/compat/osf1/syscalls.master
--- a/sys/compat/osf1/syscalls.master   Wed Apr 28 02:16:07 1999 +0000
+++ b/sys/compat/osf1/syscalls.master   Wed Apr 28 02:34:25 1999 +0000
@@ -1,4 +1,4 @@
-       $NetBSD: syscalls.master,v 1.17 1999/04/28 02:03:13 cgd Exp $
+       $NetBSD: syscalls.master,v 1.18 1999/04/28 02:34:25 cgd Exp $
 
 ;      @(#)syscalls.master     8.1 (Berkeley) 7/19/93
 
@@ -155,8 +155,8 @@
 90     NOARGS          { int sys_dup2(u_int from, u_int to); }
 91     STD             { int osf1_sys_fstat(int fd, void *sb); }
 92     STD             { int osf1_sys_fcntl(int fd, int cmd, void *arg); }
-93     NOARGS          { int sys_select(u_int nd, fd_set *in, fd_set *ou, \
-                           fd_set *ex, struct timeval *tv); }
+93     STD             { int osf1_sys_select(u_int nd, fd_set *in, \
+                           fd_set *ou, fd_set *ex, struct timeval *tv); }
 94     NOARGS          { int sys_poll(struct pollfd *fds, u_int nfds, \
                            int timeout); }
 95     NOARGS          { int sys_fsync(int fd); }



Home | Main Index | Thread Index | Old Index