BSD syscall#53
svc · unix #53
sigaltstack
Sets or queries the alternate signal stack used for handlers with SA_ONSTACK.
Prototype
int sigaltstack(struct sigaltstack *nss, struct sigaltstack *oss);Returns: int
Arguments
| Name | Type | Dir | Description |
|---|---|---|---|
| nss | struct sigaltstack | - | |
| oss | struct sigaltstack | - |
Version history
| XNU tag | macOS | # |
|---|---|---|
| xnu-1456.1.26 | macOS 10.6 Snow Leopard | 53 |
| xnu-1486.2.11 | — | 53 |
| xnu-1504.15.3 | — | 53 |
| xnu-1504.3.12 | — | 53 |
| xnu-1504.7.4 | — | 53 |
| xnu-1504.9.17 | — | 53 |
| xnu-1504.9.26 | — | 53 |
| xnu-1504.9.37 | — | 53 |
Notes
Essential when a handler may fire on a thread whose primary stack is exhausted (SIGSEGV from stack overflow). The buffer must be at least SIGSTKSZ bytes and must outlive any handler that uses it. Each pthread can have its own alt stack; the runtime configures one for the main thread in some Apple toolchains.
Detection
DTrace syscall::sigaltstack:entry exposes the new stack base in arg0 and ss_flags. Crash reporter logs show alt-stack usage when SIGSEGV is captured there.
Related APIs
sigactionsigprocmasksigsuspendkill