From 18f2cde2bd2550aff8fdf42fd6daf9ac8a92ea8b Mon Sep 17 00:00:00 2001 From: tsutsui Date: Sat, 10 Feb 2007 02:42:30 +0000 Subject: [PATCH] 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 --- sys/arch/hp300/hp300/hpux_machdep.c | 17 ++++++------ sys/compat/hpux/hpux_compat.c | 11 ++++---- sys/compat/hpux/hpux_sig.c | 43 ++++++++++++++--------------- 3 files changed, 34 insertions(+), 37 deletions(-) diff --git a/sys/arch/hp300/hp300/hpux_machdep.c b/sys/arch/hp300/hp300/hpux_machdep.c index 7fe3c89c7536..45c97b6f1f5c 100644 --- a/sys/arch/hp300/hp300/hpux_machdep.c +++ b/sys/arch/hp300/hp300/hpux_machdep.c @@ -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. @@ -107,7 +107,7 @@ */ #include -__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 #include @@ -524,7 +524,7 @@ hpux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) kf.hsf_sc.hsc_pc = frame->f_pc; /* 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); @@ -558,7 +558,7 @@ hpux_sendsig(const ksiginfo_t *ksi, const sigset_t *mask) /* Remember that we're now on the signal stack. */ if (onstack) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; #ifdef DEBUG 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 /* { syscallarg(struct hpuxsigcontext *) sigcntxp; } */ *uap = v; - struct proc *p = l->l_proc; struct hpuxsigcontext *scp; struct frame *frame; struct hpuxsigcontext tsigc; @@ -695,13 +694,13 @@ hpux_sys_sigreturn(struct lwp *l, void *v, register_t *retval) frame->f_sr = scp->hsc_ps; if (scp->hsc_onstack & SS_ONSTACK) - p->p_sigctx.ps_sigstk.ss_flags |= SS_ONSTACK; + l->l_sigstk.ss_flags |= SS_ONSTACK; else - p->p_sigctx.ps_sigstk.ss_flags &= ~SS_ONSTACK; + l->l_sigstk.ss_flags &= ~SS_ONSTACK; /* Restore signal mask. */ - hpuxtobsdmask(scp->hsc_mask, &p->p_sigctx.ps_sigmask); - sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); + hpuxtobsdmask(scp->hsc_mask, &l->l_sigmask); + sigminusset(&sigcantmask, &l->l_sigmask); #ifdef DEBUG if ((hpuxsigdebug & SDB_FPSTATE) && *(char *)&tstate.hss_fpstate) diff --git a/sys/compat/hpux/hpux_compat.c b/sys/compat/hpux/hpux_compat.c index 2291ec75de58..97aa03a89201 100644 --- a/sys/compat/hpux/hpux_compat.c +++ b/sys/compat/hpux/hpux_compat.c @@ -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 @@ -82,7 +82,7 @@ */ #include -__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) #include "opt_sysv.h" @@ -1374,7 +1374,9 @@ hpux_sys_times_6x(l, v, retval) struct tms atms; 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_stime = hpux_scale(&rs); 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; register_t *retval; { - struct proc *p = l->l_proc; - return (sigsuspend1(p, &p->p_sigctx.ps_sigmask)); + return (sigsuspend1(l, &l->l_sigmask)); } diff --git a/sys/compat/hpux/hpux_sig.c b/sys/compat/hpux/hpux_sig.c index 9ae7face2f09..4a686c46c8d7 100644 --- a/sys/compat/hpux/hpux_sig.c +++ b/sys/compat/hpux/hpux_sig.c @@ -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 @@ -82,7 +82,7 @@ */ #include -__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 #include @@ -143,7 +143,7 @@ hpux_sys_sigvec(l, v, retval) compat_43_sigvec_to_sigaction(&nsv, &nsa); } - error = sigaction1(l->l_proc, sig, + error = sigaction1(l, sig, SCARG(uap, nsv) ? &nsa : NULL, SCARG(uap, osv) ? &osa : NULL, NULL, 0); @@ -168,16 +168,15 @@ hpux_sys_sigblock(l, v, retval) register_t *retval; { struct hpux_sys_sigblock_args *uap = v; - struct proc *p = l->l_proc; sigset_t nmask; (void) splsched(); - bsdtohpuxmask(&p->p_sigctx.ps_sigmask, (int *)retval); + bsdtohpuxmask(&l->l_sigmask, (int *)retval); hpuxtobsdmask(SCARG(uap, mask), &nmask); - sigplusset(&nmask, &p->p_sigctx.ps_sigmask); - sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); + sigplusset(&nmask, &l->l_sigmask); + sigminusset(&sigcantmask, &l->l_sigmask); (void) spl0(); return (0); @@ -190,14 +189,13 @@ hpux_sys_sigsetmask(l, v, retval) register_t *retval; { struct hpux_sys_sigsetmask_args *uap = v; - struct proc *p = l->l_proc; (void) splsched(); - bsdtohpuxmask(&p->p_sigctx.ps_sigmask, (int *)retval); - hpuxtobsdmask(SCARG(uap, mask), &p->p_sigctx.ps_sigmask); + bsdtohpuxmask(&l->l_sigmask, (int *)retval); + hpuxtobsdmask(SCARG(uap, mask), &l->l_sigmask); - sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); + sigminusset(&sigcantmask, &l->l_sigmask); (void) spl0(); return (0); @@ -213,7 +211,7 @@ hpux_sys_sigpause(l, v, retval) sigset_t mask; hpuxtobsdmask(SCARG(uap, mask), &mask); - return (sigsuspend1(l->l_proc, &mask)); + return (sigsuspend1(l, &mask)); } /* not totally correct, but close enuf' */ @@ -254,7 +252,6 @@ hpux_sys_sigprocmask(l, v, retval) register_t *retval; { struct hpux_sys_sigprocmask_args *uap = v; - struct proc *p = l->l_proc; int error = 0; hpux_sigset_t sigset; sigset_t mask; @@ -265,7 +262,7 @@ hpux_sys_sigprocmask(l, v, retval) */ if (SCARG(uap, oset)) { 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)); if (error) return (error); @@ -278,15 +275,15 @@ hpux_sys_sigprocmask(l, v, retval) (void) splsched(); switch (SCARG(uap, how)) { case HPUXSIG_BLOCK: - sigplusset(&mask, &p->p_sigctx.ps_sigmask); - sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); + sigplusset(&mask, &l->l_sigmask); + sigminusset(&sigcantmask, &l->l_sigmask); break; case HPUXSIG_UNBLOCK: - sigminusset(&mask, &p->p_sigctx.ps_sigmask); + sigminusset(&mask, &l->l_sigmask); break; case HPUXSIG_SETMASK: - p->p_sigctx.ps_sigmask = mask; - sigminusset(&sigcantmask, &p->p_sigctx.ps_sigmask); + l->l_sigmask = mask; + sigminusset(&sigcantmask, &l->l_sigmask); break; default: error = EINVAL; @@ -306,7 +303,7 @@ hpux_sys_sigpending(l, v, retval) struct hpux_sys_sigpending_args *uap = v; 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))); } @@ -326,7 +323,7 @@ hpux_sys_sigsuspend(l, v, retval) return (error); hpuxtobsdmask(sigset.sigset[0], &mask); - return (sigsuspend1(l->l_proc, &mask)); + return (sigsuspend1(l, &mask)); } int @@ -382,7 +379,7 @@ hpux_sys_sigaction(l, v, retval) if (sa->hpux_sa_flags & HPUXSA_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) return (error); } @@ -423,7 +420,7 @@ hpux_sys_ssig_6x(l, v, retval) sigemptyset(&sa->sa_mask); sa->sa_flags = 0; *retval = (register_t)SIGACTION(p, a).sa_handler; - sigaction1(p, a, sa, NULL, NULL, 0); + sigaction1(l, a, sa, NULL, NULL, 0); #if 0 p->p_flag |= SOUSIG; /* mark as simulating old stuff */ #endif