diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2018-07-10 04:20:00 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2018-07-10 04:20:00 +0000 |
commit | 84563ae4ac61f5d4628a59cc1f360bac3b358a91 (patch) | |
tree | 9f1c9eefd3cc11188b6cb6067649b87f07cac5bd | |
parent | 121f0ab6733b183e0cd858c2e7b05e1d87d20cfb (diff) |
Move from sendsig() to its callers the initsiginfo() calls and
instead of passing sendsig() the code+type+val, pass a siginfo_t*
to copy from. Eliminate the indirection through struct emul for
sendsig(); we no longer have a SunOS4-compat version of sendsig()
ok deraadt@
-rw-r--r-- | sys/arch/alpha/alpha/machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 23 | ||||
-rw-r--r-- | sys/arch/arm/arm/sig_machdep.c | 18 | ||||
-rw-r--r-- | sys/arch/arm64/arm64/sig_machdep.c | 18 | ||||
-rw-r--r-- | sys/arch/hppa/hppa/machdep.c | 9 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/sig_machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/macppc/macppc/machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/sendsig.c | 10 | ||||
-rw-r--r-- | sys/arch/sh/sh/sh_machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/socppc/socppc/machdep.c | 7 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/machdep.c | 7 | ||||
-rw-r--r-- | sys/kern/exec_elf.c | 3 | ||||
-rw-r--r-- | sys/kern/init_main.c | 3 | ||||
-rw-r--r-- | sys/kern/kern_sig.c | 18 | ||||
-rw-r--r-- | sys/sys/proc.h | 4 | ||||
-rw-r--r-- | sys/sys/signalvar.h | 5 |
17 files changed, 66 insertions, 99 deletions
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 8b5646c50cb..c35aadda31d 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.185 2018/05/22 02:13:42 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.186 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */ /*- @@ -1380,8 +1380,7 @@ regdump(framep) * Send an interrupt to process. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct sigcontext ksc, *scp; @@ -1390,7 +1389,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, struct sigacts *psp = p->p_p->ps_sigacts; unsigned long oldsp; int fsize, rndfsize, kscsize; - siginfo_t *sip, ksi; + siginfo_t *sip; oldsp = alpha_pal_rdusp(); frame = p->p_md.md_tf; @@ -1398,7 +1397,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, rndfsize = ((fsize + 15) / 16) * 16; kscsize = rndfsize; if (psp->ps_siginfo & sigmask(sig)) { - fsize += sizeof ksi; + fsize += sizeof *ksip; rndfsize = ((fsize + 15) / 16) * 16; } @@ -1440,9 +1439,8 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, memset(ksc.sc_xxx, 0, sizeof ksc.sc_xxx); /* XXX */ if (psp->ps_siginfo & sigmask(sig)) { - initsiginfo(&ksi, sig, code, type, val); sip = (void *)scp + kscsize; - if (copyout((caddr_t)&ksi, (caddr_t)sip, fsize - kscsize) != 0) + if (copyout(ksip, (caddr_t)sip, fsize - kscsize) != 0) goto trash; } else sip = NULL; diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index f97d467cfaa..4453cbe45f5 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.246 2018/06/16 03:30:11 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.247 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -546,23 +546,19 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, /* * Send an interrupt to process. * - * Stack is set up to allow sigcode stored - * in u. to call routine, followed by kcall - * to sigreturn routine below. After sigreturn - * resets the signal mask, the stack, and the - * frame pointer, it returns to the user - * specified pc, psl. + * Stack is set up to allow sigcode to call routine, followed by + * syscall to sigreturn routine below. After sigreturn resets the + * signal mask, the stack, and the frame pointer, it returns to the + * user specified pc. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct trapframe *tf = p->p_md.md_regs; struct sigacts *psp = p->p_p->ps_sigacts; struct sigcontext ksc; struct savefpu *sfp = &p->p_addr->u_pcb.pcb_savefpu; - siginfo_t ksi; register_t sp, scp, sip; u_long sss; @@ -615,11 +611,10 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, sip = 0; if (psp->ps_siginfo & sigmask(sig)) { - sip = sp - ((sizeof(ksi) + 15) & ~15); - sss += (sizeof(ksi) + 15) & ~15; + sip = sp - ((sizeof(*ksip) + 15) & ~15); + sss += (sizeof(*ksip) + 15) & ~15; - initsiginfo(&ksi, sig, code, type, val); - if (copyout(&ksi, (void *)sip, sizeof(ksi))) + if (copyout(ksip, (void *)sip, sizeof(*ksip))) sigexit(p, SIGILL); } scp = sp - sss; diff --git a/sys/arch/arm/arm/sig_machdep.c b/sys/arch/arm/arm/sig_machdep.c index 4c7b9789b0e..43e9eabc20f 100644 --- a/sys/arch/arm/arm/sig_machdep.c +++ b/sys/arch/arm/arm/sig_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sig_machdep.c,v 1.17 2018/06/23 22:15:14 kettenis Exp $ */ +/* $OpenBSD: sig_machdep.c,v 1.18 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: sig_machdep.c,v 1.22 2003/10/08 00:28:41 thorpej Exp $ */ /* @@ -69,15 +69,13 @@ process_frame(struct proc *p) /* * Send an interrupt to process. * - * Stack is set up to allow sigcode stored - * in u. to call routine, followed by kcall - * to sigreturn routine below. After sigreturn - * resets the signal mask, the stack, and the - * frame pointer, it returns to the user specified pc. + * Stack is set up to allow sigcode to call routine, followed by + * syscall to sigreturn routine below. After sigreturn resets the + * signal mask, the stack, and the frame pointer, it returns to the + * user specified pc. */ void -sendsig(sig_t catcher, int sig, int returnmask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct pcb *pcb = &p->p_addr->u_pcb; @@ -129,7 +127,7 @@ sendsig(sig_t catcher, int sig, int returnmask, u_long code, int type, frame.sf_sc.sc_spsr = tf->tf_spsr; /* Save signal mask. */ - frame.sf_sc.sc_mask = returnmask; + frame.sf_sc.sc_mask = mask; /* Save FPU registers. */ frame.sf_sc.sc_fpused = pcb->pcb_flags & PCB_FPU; @@ -143,7 +141,7 @@ sendsig(sig_t catcher, int sig, int returnmask, u_long code, int type, if (psp->ps_siginfo & sigmask(sig)) { frame.sf_sip = &fp->sf_si; - initsiginfo(&frame.sf_si, sig, code, type, val); + frame.sf_si = *ksip; } frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie; diff --git a/sys/arch/arm64/arm64/sig_machdep.c b/sys/arch/arm64/arm64/sig_machdep.c index dcd0e38c0d6..016afc06832 100644 --- a/sys/arch/arm64/arm64/sig_machdep.c +++ b/sys/arch/arm64/arm64/sig_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sig_machdep.c,v 1.5 2018/04/12 17:13:43 deraadt Exp $ */ +/* $OpenBSD: sig_machdep.c,v 1.6 2018/07/10 04:19:59 guenther Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -89,15 +89,13 @@ process_frame(struct proc *p) /* * Send an interrupt to process. * - * Stack is set up to allow sigcode stored - * in u. to call routine, followed by kcall - * to sigreturn routine below. After sigreturn - * resets the signal mask, the stack, and the - * frame pointer, it returns to the user specified pc. + * Stack is set up to allow sigcode to call routine, followed by + * syscall to sigreturn routine below. After sigreturn resets the + * signal mask, the stack, and the frame pointer, it returns to the + * user specified pc. */ void -sendsig(sig_t catcher, int sig, int returnmask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct trapframe *tf; @@ -135,13 +133,13 @@ sendsig(sig_t catcher, int sig, int returnmask, u_long code, int type, frame.sf_sc.sc_spsr = tf->tf_spsr; /* Save signal mask. */ - frame.sf_sc.sc_mask = returnmask; + frame.sf_sc.sc_mask = mask; /* XXX Save floating point context */ if (psp->ps_siginfo & sigmask(sig)) { sip = &fp->sf_si; - initsiginfo(&frame.sf_si, sig, code, type, val); + frame.sf_si = *ksip; } frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie; diff --git a/sys/arch/hppa/hppa/machdep.c b/sys/arch/hppa/hppa/machdep.c index d8ba7b65f8b..1a3b3bd35d2 100644 --- a/sys/arch/hppa/hppa/machdep.c +++ b/sys/arch/hppa/hppa/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.252 2018/05/22 02:13:42 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.253 2018/07/10 04:19:59 guenther Exp $ */ /* * Copyright (c) 1999-2003 Michael Shalayeff @@ -1198,15 +1198,13 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack, * Send an interrupt to process. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct trapframe *tf = p->p_md.md_regs; struct pcb *pcb = &p->p_addr->u_pcb; struct sigacts *psp = p->p_p->ps_sigacts; struct sigcontext ksc; - siginfo_t ksi; register_t scp, sip; int sss; @@ -1288,8 +1286,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, sigexit(p, SIGILL); if (sip) { - initsiginfo(&ksi, sig, code, type, val); - if (copyout(&ksi, (void *)sip, sizeof(ksi))) + if (copyout(ksip, (void *)sip, sizeof *ksip)) sigexit(p, SIGILL); } } diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 36693bc45d3..350c7d65ed6 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.619 2018/07/09 19:20:29 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.620 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2381,8 +2381,7 @@ pentium_cpuspeed(int *freq) * specified pc, psl. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct trapframe *tf = p->p_md.md_regs; @@ -2449,7 +2448,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, if (psp->ps_siginfo & sigmask(sig)) { frame.sf_sip = &fp->sf_si; - initsiginfo(&frame.sf_si, sig, code, type, val); + frame.sf_si = *ksip; } /* XXX don't copyout siginfo if not needed? */ diff --git a/sys/arch/m88k/m88k/sig_machdep.c b/sys/arch/m88k/m88k/sig_machdep.c index 7b9766ab7b5..579ac281b31 100644 --- a/sys/arch/m88k/m88k/sig_machdep.c +++ b/sys/arch/m88k/m88k/sig_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sig_machdep.c,v 1.28 2018/04/12 17:13:43 deraadt Exp $ */ +/* $OpenBSD: sig_machdep.c,v 1.29 2018/07/10 04:19:59 guenther Exp $ */ /* * Copyright (c) 2014 Miodrag Vallat. * @@ -104,8 +104,7 @@ pid_t sigpid = 0; * Send an interrupt to process. */ void -sendsig(sig_t catcher, int sig, int mask, unsigned long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct trapframe *tf; @@ -144,7 +143,7 @@ sendsig(sig_t catcher, int sig, int mask, unsigned long code, int type, sf.sf_sc.sc_cookie = (long)sf.sf_scp ^ p->p_p->ps_sigcookie; if (psp->ps_siginfo & sigmask(sig)) - initsiginfo(&sf.sf_si, sig, code, type, val); + sf.sf_si = *ksip; /* * Copy the whole user context into signal context that we diff --git a/sys/arch/macppc/macppc/machdep.c b/sys/arch/macppc/macppc/machdep.c index 1470b2a78df..796fab837ef 100644 --- a/sys/arch/macppc/macppc/machdep.c +++ b/sys/arch/macppc/macppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.183 2018/04/12 17:13:43 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.184 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -442,8 +442,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack, * Send a signal to process. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct trapframe *tf; @@ -476,7 +475,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, bcopy(tf, &frame.sf_sc.sc_frame, sizeof *tf); if (psp->ps_siginfo & sigmask(sig)) { frame.sf_sip = &fp->sf_si; - initsiginfo(&frame.sf_si, sig, code, type, val); + frame.sf_si = *ksip; } frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie; if (copyout(&frame, fp, sizeof frame) != 0) diff --git a/sys/arch/mips64/mips64/sendsig.c b/sys/arch/mips64/mips64/sendsig.c index c05c6652134..45ae47d4825 100644 --- a/sys/arch/mips64/mips64/sendsig.c +++ b/sys/arch/mips64/mips64/sendsig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sendsig.c,v 1.29 2018/05/22 02:13:42 guenther Exp $ */ +/* $OpenBSD: sendsig.c,v 1.30 2018/07/10 04:19:59 guenther Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -92,8 +92,7 @@ struct sigframe { * Send an interrupt to process. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct cpu_info *ci = curcpu(); struct proc *p = curproc; @@ -139,10 +138,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, } if (psp->ps_siginfo & sigmask(sig)) { - siginfo_t si; - - initsiginfo(&si, sig, code, type, val); - if (copyout((caddr_t)&si, (caddr_t)&fp->sf_si, sizeof si)) + if (copyout(ksip, (caddr_t)&fp->sf_si, sizeof *ksip)) goto bail; } diff --git a/sys/arch/sh/sh/sh_machdep.c b/sys/arch/sh/sh/sh_machdep.c index 218db7f2e75..56f32389dac 100644 --- a/sys/arch/sh/sh/sh_machdep.c +++ b/sys/arch/sh/sh/sh_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sh_machdep.c,v 1.47 2018/04/12 17:13:44 deraadt Exp $ */ +/* $OpenBSD: sh_machdep.c,v 1.48 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: sh3_machdep.c,v 1.59 2006/03/04 01:13:36 uwe Exp $ */ /* @@ -448,8 +448,7 @@ struct sigframe { * Send an interrupt to process. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct sigframe *fp, frame; @@ -470,7 +469,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, bzero(&frame, sizeof(frame)); if (psp->ps_siginfo & sigmask(sig)) { - initsiginfo(&frame.sf_si, sig, code, type, val); + frame.sf_si = *ksip; sip = &fp->sf_si; } else sip = NULL; diff --git a/sys/arch/socppc/socppc/machdep.c b/sys/arch/socppc/socppc/machdep.c index 830a2e24307..ef6cd748e55 100644 --- a/sys/arch/socppc/socppc/machdep.c +++ b/sys/arch/socppc/socppc/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.74 2018/04/12 17:13:44 deraadt Exp $ */ +/* $OpenBSD: machdep.c,v 1.75 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.4 1996/10/16 19:33:11 ws Exp $ */ /* @@ -468,8 +468,7 @@ setregs(struct proc *p, struct exec_package *pack, u_long stack, * Send a signal to process. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct trapframe *tf; @@ -502,7 +501,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, bcopy(tf, &frame.sf_sc.sc_frame, sizeof *tf); if (psp->ps_siginfo & sigmask(sig)) { frame.sf_sip = &fp->sf_si; - initsiginfo(&frame.sf_si, sig, code, type, val); + frame.sf_si = *ksip; } frame.sf_sc.sc_cookie = (long)&fp->sf_sc ^ p->p_p->ps_sigcookie; if (copyout(&frame, fp, sizeof frame) != 0) diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index 872b2896fcf..9deec63d527 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.189 2018/05/22 02:13:42 guenther Exp $ */ +/* $OpenBSD: machdep.c,v 1.190 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -404,8 +404,7 @@ cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, * Send an interrupt to process. */ void -sendsig(sig_t catcher, int sig, int mask, u_long code, int type, - union sigval val) +sendsig(sig_t catcher, int sig, sigset_t mask, const siginfo_t *ksip) { struct proc *p = curproc; struct sigacts *psp = p->p_p->ps_sigacts; @@ -453,7 +452,7 @@ sendsig(sig_t catcher, int sig, int mask, u_long code, int type, if (psp->ps_siginfo & sigmask(sig)) { sf.sf_sip = &fp->sf_si; - initsiginfo(&sf.sf_si, sig, code, type, val); + sf.sf_si = *ksip; } /* diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c index 0a2fc0a9c8a..6fb2183db65 100644 --- a/sys/kern/exec_elf.c +++ b/sys/kern/exec_elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.c,v 1.142 2017/12/30 23:08:29 guenther Exp $ */ +/* $OpenBSD: exec_elf.c,v 1.143 2018/07/10 04:19:59 guenther Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -132,7 +132,6 @@ extern char *syscallnames[]; struct emul emul_elf = { "native", NULL, - sendsig, SYS_syscall, SYS_MAXSYSCALL, sysent, diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index f5a4984070a..f4381ae8bd6 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: init_main.c,v 1.277 2018/04/28 03:13:04 visa Exp $ */ +/* $OpenBSD: init_main.c,v 1.278 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: init_main.c,v 1.84.4.1 1996/06/02 09:08:06 mrg Exp $ */ /* @@ -159,7 +159,6 @@ extern char *syscallnames[]; struct emul emul_native = { "native", NULL, - sendsig, SYS_syscall, SYS_MAXSYSCALL, sysent, diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index db7adf619ba..823ab102b7b 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.220 2018/04/28 03:13:04 visa Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.221 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -798,17 +798,15 @@ trapsignal(struct proc *p, int signum, u_long trapno, int code, if ((pr->ps_flags & PS_TRACED) == 0 && (ps->ps_sigcatch & mask) != 0 && (p->p_sigmask & mask) == 0) { + siginfo_t si; + initsiginfo(&si, signum, trapno, code, sigval); #ifdef KTRACE if (KTRPOINT(p, KTR_PSIG)) { - siginfo_t si; - - initsiginfo(&si, signum, trapno, code, sigval); ktrpsig(p, signum, ps->ps_sigact[signum], p->p_sigmask, code, &si); } #endif - (*pr->ps_emul->e_sendsig)(ps->ps_sigact[signum], signum, - p->p_sigmask, trapno, code, sigval); + sendsig(ps->ps_sigact[signum], signum, p->p_sigmask, &si); postsig_done(p, signum, ps); } else { p->p_sisig = signum; @@ -1359,6 +1357,7 @@ postsig(struct proc *p, int signum) sig_t action; u_long trapno; int mask, returnmask; + siginfo_t si; union sigval sigval; int s, code; @@ -1379,12 +1378,10 @@ postsig(struct proc *p, int signum) code = p->p_sicode; sigval = p->p_sigval; } + initsiginfo(&si, signum, trapno, code, sigval); #ifdef KTRACE if (KTRPOINT(p, KTR_PSIG)) { - siginfo_t si; - - initsiginfo(&si, signum, trapno, code, sigval); ktrpsig(p, signum, action, p->p_flag & P_SIGSUSPEND ? p->p_oldmask : p->p_sigmask, code, &si); } @@ -1431,8 +1428,7 @@ postsig(struct proc *p, int signum) p->p_sigval.sival_ptr = NULL; } - (*pr->ps_emul->e_sendsig)(action, signum, returnmask, trapno, - code, sigval); + sendsig(action, signum, returnmask, &si); postsig_done(p, signum, ps); splx(s); } diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 40f36d11ee7..cb95743ba69 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.249 2018/06/17 08:22:02 anton Exp $ */ +/* $OpenBSD: proc.h,v 1.250 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: proc.h,v 1.44 1996/04/22 01:23:21 christos Exp $ */ /*- @@ -94,8 +94,6 @@ union sigval; struct emul { char e_name[8]; /* Symbolic name */ int *e_errno; /* Errno array */ - /* Signal sending function */ - void (*e_sendsig)(void (*)(int), int, int, u_long, int, union sigval); int e_nosys; /* Offset of the nosys() syscall */ int e_nsysent; /* Number of system call entries */ struct sysent *e_sysent; /* System call array */ diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h index 8fbe630a628..dd36d730e65 100644 --- a/sys/sys/signalvar.h +++ b/sys/sys/signalvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: signalvar.h,v 1.30 2018/03/24 04:13:59 visa Exp $ */ +/* $OpenBSD: signalvar.h,v 1.31 2018/07/10 04:19:59 guenther Exp $ */ /* $NetBSD: signalvar.h,v 1.17 1996/04/22 01:23:31 christos Exp $ */ /* @@ -178,7 +178,6 @@ void sigactsfree(struct process *); /* * Machine-dependent functions: */ -void sendsig(sig_t action, int sig, int returnmask, u_long code, - int type, union sigval val); +void sendsig(sig_t _catcher, int _sig, sigset_t _mask, const siginfo_t *_si); #endif /* _KERNEL */ #endif /* !_SYS_SIGNALVAR_H_ */ |