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 setitimer(), but for now just return...



details:   https://anonhg.NetBSD.org/src/rev/18a1c2a9748d
branches:  trunk
changeset: 472453:18a1c2a9748d
user:      cgd <cgd%NetBSD.org@localhost>
date:      Thu Apr 29 23:37:23 1999 +0000

description:
emulate setitimer(), but for now just return EINVAL.  stub sysinfo() (XXX).

diffstat:

 sys/compat/osf1/osf1_misc.c |  101 +++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 100 insertions(+), 1 deletions(-)

diffs (112 lines):

diff -r ef5d80413331 -r 18a1c2a9748d sys/compat/osf1/osf1_misc.c
--- a/sys/compat/osf1/osf1_misc.c       Thu Apr 29 22:20:42 1999 +0000
+++ b/sys/compat/osf1/osf1_misc.c       Thu Apr 29 23:37:23 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_misc.c,v 1.34 1999/04/29 17:18:59 thorpej Exp $ */
+/* $NetBSD: osf1_misc.c,v 1.35 1999/04/29 23:37:23 cgd Exp $ */
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -1489,3 +1489,102 @@
 
        return sys_access(p, &a, retval);
 }
+
+int
+osf1_sys_setitimer(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct osf1_sys_setitimer_args *uap = v;
+       struct sys_setitimer_args a;
+       struct osf1_itimerval o_itv, o_oitv;
+       struct itimerval b_itv, b_oitv;
+       caddr_t sg;
+       int error;
+
+#if 1
+       return EINVAL;
+#endif
+
+       switch (SCARG(uap, which)) {
+       case OSF1_ITIMER_REAL:
+               SCARG(&a, which) = ITIMER_REAL;
+               break;
+
+       case OSF1_ITIMER_VIRTUAL:
+               SCARG(&a, which) = ITIMER_VIRTUAL;
+               break;
+
+       case OSF1_ITIMER_PROF:
+               SCARG(&a, which) = ITIMER_PROF;
+               break;
+
+       default:
+               return (EINVAL);
+       }
+
+       sg = stackgap_init(p->p_emul);
+
+       SCARG(&a, itv) = stackgap_alloc(&sg, sizeof b_itv);
+
+       /* get the OSF/1 itimerval argument */
+       error = copyin((caddr_t)SCARG(uap, itv), (caddr_t)&o_itv,
+           sizeof o_itv);
+       if (error == 0) {
+
+               /* fill in and copy out the NetBSD timeval */
+               memset(&b_itv, 0, sizeof b_itv);
+               b_itv.it_interval.tv_sec = o_itv.it_interval.tv_sec;
+               b_itv.it_interval.tv_usec = o_itv.it_interval.tv_usec;
+               b_itv.it_value.tv_sec = o_itv.it_value.tv_sec;
+               b_itv.it_value.tv_usec = o_itv.it_value.tv_usec;
+
+               error = copyout((caddr_t)&b_itv,
+                   (caddr_t)SCARG(&a, itv), sizeof b_itv);
+       }
+
+       if (SCARG(uap, oitv) == NULL)
+               SCARG(&a, oitv) = NULL;
+       else
+               SCARG(&a, oitv) = stackgap_alloc(&sg, sizeof b_oitv);
+
+       if (error == 0)
+               error = sys_setitimer(p, &a, retval);
+
+       if (error == 0 && SCARG(uap, oitv) != NULL) {
+               /* get the NetBSD itimerval return value */
+               error = copyin((caddr_t)SCARG(&a, oitv), (caddr_t)&b_oitv,
+                   sizeof b_oitv);
+               if (error == 0) {
+       
+                       /* fill in and copy out the NetBSD timeval */
+                       memset(&o_oitv, 0, sizeof o_oitv);
+                       o_oitv.it_interval.tv_sec = b_oitv.it_interval.tv_sec;
+                       o_oitv.it_interval.tv_usec = b_oitv.it_interval.tv_usec;
+                       o_oitv.it_value.tv_sec = b_oitv.it_value.tv_sec;
+                       o_oitv.it_value.tv_usec = b_oitv.it_value.tv_usec;
+       
+                       error = copyout((caddr_t)&o_oitv,
+                           (caddr_t)SCARG(uap, oitv), sizeof o_oitv);
+               }
+       }
+
+       return (error);
+}
+
+int
+osf1_sys_sysinfo(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct osf1_sys_sysinfo_args *uap = v;
+
+       printf("osf1_sys_sysinfo(%d, %p, 0x%lx)\n", SCARG(uap, cmd),
+           SCARG(uap, buf), SCARG(uap,len));
+       copyoutstr("", SCARG(uap, buf), SCARG(uap,len), 0);
+
+       /* XXX */
+       return (0);
+}



Home | Main Index | Thread Index | Old Index