diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-09-16 13:50:43 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2020-09-16 13:50:43 +0000 |
commit | f17d230a05e28ced3e5b0a21ebdda2b2937a5eaf (patch) | |
tree | c07032684d18d59ca2030d7c2896ab2dd0d291ae /sys/kern/kern_sig.c | |
parent | a6affcf53d632e39c232c490fdfb9c258e260452 (diff) |
Move duplicated code to send an uncatchable SIGABRT into a function.
ok claudio@
Diffstat (limited to 'sys/kern/kern_sig.c')
-rw-r--r-- | sys/kern/kern_sig.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 1cad8c58e2e..b1c6f11c745 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.262 2020/09/13 13:33:37 claudio Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.263 2020/09/16 13:50:42 mpi Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -122,6 +122,8 @@ const int sigprop[NSIG + 1] = { #define stopsigmask (sigmask(SIGSTOP) | sigmask(SIGTSTP) | \ sigmask(SIGTTIN) | sigmask(SIGTTOU)) +void setsigvec(struct proc *, int, struct sigaction *); + void proc_stop(struct proc *p, int); void proc_stop_sweep(void *); void *proc_stop_si; @@ -1486,6 +1488,21 @@ sigexit(struct proc *p, int signum) } /* + * Send uncatchable SIGABRT for coredump. + */ +void +sigabort(struct proc *p) +{ + struct sigaction sa; + + memset(&sa, 0, sizeof sa); + sa.sa_handler = SIG_DFL; + setsigvec(p, SIGABRT, &sa); + atomic_clearbits_int(&p->p_sigmask, sigmask(SIGABRT)); + psignal(p, SIGABRT); +} + +/* * Return 1 if `sig', a given signal, is ignored or masked for `p', a given * thread, and 0 otherwise. */ |