Skip to content
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

NameTypeDirDescription
nssstruct sigaltstack-
ossstruct sigaltstack-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard53
xnu-1486.2.1153
xnu-1504.15.353
xnu-1504.3.1253
xnu-1504.7.453
xnu-1504.9.1753
xnu-1504.9.2653
xnu-1504.9.3753

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