mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-06 09:50:28 +00:00
Improve quality of raise(), abort(), and tkill()
This change fixes a nasty bug where SIG_IGN and SIG_DFL weren't working as advertised on BSDs. This change also fixes the tkill() definition on MacOS so it maps to __pthread_kill().
This commit is contained in:
parent
c5659b93f8
commit
c5c4dfcd21
12 changed files with 293 additions and 63 deletions
|
@ -182,8 +182,11 @@ static int __sigaction(int sig, const struct sigaction *act,
|
|||
ap = ©
|
||||
if (IsXnu()) {
|
||||
ap->sa_restorer = (void *)&__sigenter_xnu;
|
||||
ap->sa_handler = (void *)&__sigenter_xnu;
|
||||
|
||||
if (rva < kSigactionMinRva) {
|
||||
ap->sa_sigaction = (void *)(intptr_t)rva;
|
||||
} else {
|
||||
ap->sa_sigaction = (void *)&__sigenter_xnu;
|
||||
}
|
||||
// mitigate Rosetta signal handling strangeness
|
||||
// https://github.com/jart/cosmopolitan/issues/455
|
||||
ap->sa_flags |= SA_SIGINFO;
|
||||
|
@ -193,11 +196,23 @@ static int __sigaction(int sig, const struct sigaction *act,
|
|||
ap->sa_restorer = &__restore_rt;
|
||||
}
|
||||
} else if (IsNetbsd()) {
|
||||
ap->sa_sigaction = (sigaction_f)__sigenter_netbsd;
|
||||
if (rva < kSigactionMinRva) {
|
||||
ap->sa_sigaction = (void *)(intptr_t)rva;
|
||||
} else {
|
||||
ap->sa_sigaction = (sigaction_f)__sigenter_netbsd;
|
||||
}
|
||||
} else if (IsFreebsd()) {
|
||||
ap->sa_sigaction = (sigaction_f)__sigenter_freebsd;
|
||||
if (rva < kSigactionMinRva) {
|
||||
ap->sa_sigaction = (void *)(intptr_t)rva;
|
||||
} else {
|
||||
ap->sa_sigaction = (sigaction_f)__sigenter_freebsd;
|
||||
}
|
||||
} else if (IsOpenbsd()) {
|
||||
ap->sa_sigaction = (sigaction_f)__sigenter_openbsd;
|
||||
if (rva < kSigactionMinRva) {
|
||||
ap->sa_sigaction = (void *)(intptr_t)rva;
|
||||
} else {
|
||||
ap->sa_sigaction = (sigaction_f)__sigenter_openbsd;
|
||||
}
|
||||
} else {
|
||||
return enosys();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue