emulate select(), to get the timeval right.

And CGD said, "Let there be eyes!"  And there were eyes, and it was good.
This commit is contained in:
cgd 1999-04-28 02:34:25 +00:00
parent 4c9a03c3b3
commit a9deaa593a
2 changed files with 50 additions and 4 deletions

View File

@ -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 @@ osf1_sys_gettimeofday(p, v, retval)
}
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);
}

View File

@ -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); }