mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-04 18:28:30 +00:00
Polyfill SA_RESETHAND on MacOS ARM64
This change solves the XNU crash loop mystery. Apple's documentation claims to support this feature, but they only define the constant in their header files. The kernel acknowledges thi SA_RESETHAND bit, by clearing it from the sa_flags state, returns zero, and does nothing.
This commit is contained in:
parent
952b9009e8
commit
793393a341
3 changed files with 23 additions and 2 deletions
|
@ -252,6 +252,12 @@ static int __sigaction(int sig, const struct sigaction *act,
|
|||
rc = sys_sigaction(sig, ap, oldact, arg4, arg5);
|
||||
} else {
|
||||
rc = _sysret(__syslib->__sigaction(sig, ap, oldact));
|
||||
// xnu silicon claims to support sa_resethand but it does nothing
|
||||
// this can be tested, since it clears the bit from flags as well
|
||||
if (!rc && oldact &&
|
||||
(((struct sigaction_silicon *)ap)->sa_flags & SA_RESETHAND)) {
|
||||
((struct sigaction_silicon *)oldact)->sa_flags |= SA_RESETHAND;
|
||||
}
|
||||
}
|
||||
if (rc != -1) {
|
||||
sigaction_native2cosmo((union metasigaction *)oldact);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue