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

This commit is contained in:
cgd 1999-04-29 23:37:23 +00:00
parent 986bcb3e71
commit 59c243a0b7
1 changed files with 100 additions and 1 deletions

View File

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