Make COMPAT_HPUX compile by mechanical replacements.

XXX1: not sure if it still works even before newlock2 merge
XXX2: some more mutex locks might be required
This commit is contained in:
tsutsui 2007-02-10 02:42:30 +00:00
parent 3e828b086d
commit 18f2cde2bd
3 changed files with 34 additions and 37 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpux_machdep.c,v 1.44 2007/02/09 21:55:03 ad Exp $ */ /* $NetBSD: hpux_machdep.c,v 1.45 2007/02/10 02:42:30 tsutsui Exp $ */
/*- /*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -107,7 +107,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hpux_machdep.c,v 1.44 2007/02/09 21:55:03 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: hpux_machdep.c,v 1.45 2007/02/10 02:42:30 tsutsui Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -524,7 +524,7 @@ hpux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
kf.hsf_sc.hsc_pc = frame->f_pc; kf.hsf_sc.hsc_pc = frame->f_pc;
/* Save the signal stack. */ /* Save the signal stack. */
kf.hsf_sc.hsc_onstack = p->p_sigctx.ps_sigstk.ss_flags & SS_ONSTACK; kf.hsf_sc.hsc_onstack = l->l_sigstk.ss_flags & SS_ONSTACK;
bsdtohpuxmask(mask, &kf.hsf_sc.hsc_mask); bsdtohpuxmask(mask, &kf.hsf_sc.hsc_mask);
@ -558,7 +558,7 @@ hpux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask)
/* Remember that we're now on the signal stack. */ /* Remember that we're now on the signal stack. */
if (onstack) if (onstack)
p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; l->l_sigstk.ss_flags |= SS_ONSTACK;
#ifdef DEBUG #ifdef DEBUG
if ((hpuxsigdebug & SDB_KSTACK) && p->p_pid == hpuxsigpid) if ((hpuxsigdebug & SDB_KSTACK) && p->p_pid == hpuxsigpid)
@ -584,7 +584,6 @@ hpux_sys_sigreturn(struct lwp *l, void *v, register_t *retval)
struct hpux_sys_sigreturn_args /* { struct hpux_sys_sigreturn_args /* {
syscallarg(struct hpuxsigcontext *) sigcntxp; syscallarg(struct hpuxsigcontext *) sigcntxp;
} */ *uap = v; } */ *uap = v;
struct proc *p = l->l_proc;
struct hpuxsigcontext *scp; struct hpuxsigcontext *scp;
struct frame *frame; struct frame *frame;
struct hpuxsigcontext tsigc; struct hpuxsigcontext tsigc;
@ -695,13 +694,13 @@ hpux_sys_sigreturn(struct lwp *l, void *v, register_t *retval)
frame->f_sr = scp->hsc_ps; frame->f_sr = scp->hsc_ps;
if (scp->hsc_onstack & SS_ONSTACK) if (scp->hsc_onstack & SS_ONSTACK)
p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; l->l_sigstk.ss_flags |= SS_ONSTACK;
else else
p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; l->l_sigstk.ss_flags &= ~SS_ONSTACK;
/* Restore signal mask. */ /* Restore signal mask. */
hpuxtobsdmask(scp->hsc_mask, &p->p_sigctx.ps_sigmask); hpuxtobsdmask(scp->hsc_mask, &l->l_sigmask);
sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); sigminusset(&sigcantmask, &l->l_sigmask);
#ifdef DEBUG #ifdef DEBUG
if ((hpuxsigdebug & SDB_FPSTATE) && *(char *)&tstate.hss_fpstate) if ((hpuxsigdebug & SDB_FPSTATE) && *(char *)&tstate.hss_fpstate)

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpux_compat.c,v 1.83 2007/02/09 21:55:16 ad Exp $ */ /* $NetBSD: hpux_compat.c,v 1.84 2007/02/10 02:42:30 tsutsui Exp $ */
/* /*
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -82,7 +82,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hpux_compat.c,v 1.83 2007/02/09 21:55:16 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: hpux_compat.c,v 1.84 2007/02/10 02:42:30 tsutsui Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_sysv.h" #include "opt_sysv.h"
@ -1374,7 +1374,9 @@ hpux_sys_times_6x(l, v, retval)
struct tms atms; struct tms atms;
int error; int error;
calcru(p, &ru, &rs, NULL); mutex_enter(&p->p_smutex);
calcru(p, &ru, &rs, NULL, NULL);
mutex_exit(&p->p_smutex);
atms.tms_utime = hpux_scale(&ru); atms.tms_utime = hpux_scale(&ru);
atms.tms_stime = hpux_scale(&rs); atms.tms_stime = hpux_scale(&rs);
atms.tms_cutime = hpux_scale(&p->p_stats->p_cru.ru_utime); atms.tms_cutime = hpux_scale(&p->p_stats->p_cru.ru_utime);
@ -1452,7 +1454,6 @@ hpux_sys_pause_6x(l, v, retval)
void *v; void *v;
register_t *retval; register_t *retval;
{ {
struct proc *p = l->l_proc;
return (sigsuspend1(p, &p->p_sigctx.ps_sigmask)); return (sigsuspend1(l, &l->l_sigmask));
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpux_sig.c,v 1.30 2007/02/09 21:55:16 ad Exp $ */ /* $NetBSD: hpux_sig.c,v 1.31 2007/02/10 02:42:30 tsutsui Exp $ */
/* /*
* Copyright (c) 1990, 1993 * Copyright (c) 1990, 1993
@ -82,7 +82,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hpux_sig.c,v 1.30 2007/02/09 21:55:16 ad Exp $"); __KERNEL_RCSID(0, "$NetBSD: hpux_sig.c,v 1.31 2007/02/10 02:42:30 tsutsui Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -143,7 +143,7 @@ hpux_sys_sigvec(l, v, retval)
compat_43_sigvec_to_sigaction(&nsv, &nsa); compat_43_sigvec_to_sigaction(&nsv, &nsa);
} }
error = sigaction1(l->l_proc, sig, error = sigaction1(l, sig,
SCARG(uap, nsv) ? &nsa : NULL, SCARG(uap, nsv) ? &nsa : NULL,
SCARG(uap, osv) ? &osa : NULL, SCARG(uap, osv) ? &osa : NULL,
NULL, 0); NULL, 0);
@ -168,16 +168,15 @@ hpux_sys_sigblock(l, v, retval)
register_t *retval; register_t *retval;
{ {
struct hpux_sys_sigblock_args *uap = v; struct hpux_sys_sigblock_args *uap = v;
struct proc *p = l->l_proc;
sigset_t nmask; sigset_t nmask;
(void) splsched(); (void) splsched();
bsdtohpuxmask(&p->p_sigctx.ps_sigmask, (int *)retval); bsdtohpuxmask(&l->l_sigmask, (int *)retval);
hpuxtobsdmask(SCARG(uap, mask), &nmask); hpuxtobsdmask(SCARG(uap, mask), &nmask);
sigplusset(&nmask, &p->p_sigctx.ps_sigmask); sigplusset(&nmask, &l->l_sigmask);
sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); sigminusset(&sigcantmask, &l->l_sigmask);
(void) spl0(); (void) spl0();
return (0); return (0);
@ -190,14 +189,13 @@ hpux_sys_sigsetmask(l, v, retval)
register_t *retval; register_t *retval;
{ {
struct hpux_sys_sigsetmask_args *uap = v; struct hpux_sys_sigsetmask_args *uap = v;
struct proc *p = l->l_proc;
(void) splsched(); (void) splsched();
bsdtohpuxmask(&p->p_sigctx.ps_sigmask, (int *)retval); bsdtohpuxmask(&l->l_sigmask, (int *)retval);
hpuxtobsdmask(SCARG(uap, mask), &p->p_sigctx.ps_sigmask); hpuxtobsdmask(SCARG(uap, mask), &l->l_sigmask);
sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); sigminusset(&sigcantmask, &l->l_sigmask);
(void) spl0(); (void) spl0();
return (0); return (0);
@ -213,7 +211,7 @@ hpux_sys_sigpause(l, v, retval)
sigset_t mask; sigset_t mask;
hpuxtobsdmask(SCARG(uap, mask), &mask); hpuxtobsdmask(SCARG(uap, mask), &mask);
return (sigsuspend1(l->l_proc, &mask)); return (sigsuspend1(l, &mask));
} }
/* not totally correct, but close enuf' */ /* not totally correct, but close enuf' */
@ -254,7 +252,6 @@ hpux_sys_sigprocmask(l, v, retval)
register_t *retval; register_t *retval;
{ {
struct hpux_sys_sigprocmask_args *uap = v; struct hpux_sys_sigprocmask_args *uap = v;
struct proc *p = l->l_proc;
int error = 0; int error = 0;
hpux_sigset_t sigset; hpux_sigset_t sigset;
sigset_t mask; sigset_t mask;
@ -265,7 +262,7 @@ hpux_sys_sigprocmask(l, v, retval)
*/ */
if (SCARG(uap, oset)) { if (SCARG(uap, oset)) {
memset((caddr_t)&sigset, 0, sizeof(sigset)); memset((caddr_t)&sigset, 0, sizeof(sigset));
bsdtohpuxmask(&p->p_sigctx.ps_sigmask, &sigset.sigset[0]); bsdtohpuxmask(&l->l_sigmask, &sigset.sigset[0]);
error = copyout(&sigset, SCARG(uap, oset), sizeof(sigset)); error = copyout(&sigset, SCARG(uap, oset), sizeof(sigset));
if (error) if (error)
return (error); return (error);
@ -278,15 +275,15 @@ hpux_sys_sigprocmask(l, v, retval)
(void) splsched(); (void) splsched();
switch (SCARG(uap, how)) { switch (SCARG(uap, how)) {
case HPUXSIG_BLOCK: case HPUXSIG_BLOCK:
sigplusset(&mask, &p->p_sigctx.ps_sigmask); sigplusset(&mask, &l->l_sigmask);
sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); sigminusset(&sigcantmask, &l->l_sigmask);
break; break;
case HPUXSIG_UNBLOCK: case HPUXSIG_UNBLOCK:
sigminusset(&mask, &p->p_sigctx.ps_sigmask); sigminusset(&mask, &l->l_sigmask);
break; break;
case HPUXSIG_SETMASK: case HPUXSIG_SETMASK:
p->p_sigctx.ps_sigmask = mask; l->l_sigmask = mask;
sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); sigminusset(&sigcantmask, &l->l_sigmask);
break; break;
default: default:
error = EINVAL; error = EINVAL;
@ -306,7 +303,7 @@ hpux_sys_sigpending(l, v, retval)
struct hpux_sys_sigpending_args *uap = v; struct hpux_sys_sigpending_args *uap = v;
hpux_sigset_t sigset; hpux_sigset_t sigset;
bsdtohpuxmask(&l->l_proc->p_sigctx.ps_siglist, &sigset.sigset[0]); bsdtohpuxmask(&l->l_sigpendset->sp_set, &sigset.sigset[0]);
return (copyout(&sigset, SCARG(uap, set), sizeof(sigset))); return (copyout(&sigset, SCARG(uap, set), sizeof(sigset)));
} }
@ -326,7 +323,7 @@ hpux_sys_sigsuspend(l, v, retval)
return (error); return (error);
hpuxtobsdmask(sigset.sigset[0], &mask); hpuxtobsdmask(sigset.sigset[0], &mask);
return (sigsuspend1(l->l_proc, &mask)); return (sigsuspend1(l, &mask));
} }
int int
@ -382,7 +379,7 @@ hpux_sys_sigaction(l, v, retval)
if (sa->hpux_sa_flags & HPUXSA_NOCLDSTOP) if (sa->hpux_sa_flags & HPUXSA_NOCLDSTOP)
act.sa_flags |= SA_NOCLDSTOP; act.sa_flags |= SA_NOCLDSTOP;
error = sigaction1(l->l_proc, sig, &act, NULL, NULL, 0); error = sigaction1(l, sig, &act, NULL, NULL, 0);
if (error) if (error)
return (error); return (error);
} }
@ -423,7 +420,7 @@ hpux_sys_ssig_6x(l, v, retval)
sigemptyset(&sa->sa_mask); sigemptyset(&sa->sa_mask);
sa->sa_flags = 0; sa->sa_flags = 0;
*retval = (register_t)SIGACTION(p, a).sa_handler; *retval = (register_t)SIGACTION(p, a).sa_handler;
sigaction1(p, a, sa, NULL, NULL, 0); sigaction1(l, a, sa, NULL, NULL, 0);
#if 0 #if 0
p->p_flag |= SOUSIG; /* mark as simulating old stuff */ p->p_flag |= SOUSIG; /* mark as simulating old stuff */
#endif #endif