Allows a process to define and examine the state of an alternate stack for signal handlers.
int sigaltstack(const stack_t *ss, stack_t *oss);
The sigaltstack subroutine allows a process to define and examine the state of an alternate stack for signal handlers. Signals that have been explicitly declared to execute on the alternate stack will be delivered on the alternate stack.
If ss is not null pointer, it points to a stack_t structure that specifies the alternate signal stack that will take effect upon return from sigaltstack subroutine. The ss_flags member specifies the new stack state. If it is set to SS_DISABLE, the stack is disabled and ss_sp and ss_ssize are ignored. Otherwise the stack will be enabled, and the ss_sp and ss_size members specify the new address and size of the stack.
The range of addresses starting at ss_sp, up to but not including ss_sp + ss_size, is available to the implementation for use as the stack.
If oss is not a null
pointer, on successful completion it will point to a stack_t
structure that specifies the alternate signal stack that was in effect prior
to the sigaltstack subroutine. The ss_sp and
ss_size members specify the address and size of the stack.
The ss_flags member specifies the stack's state, and may
contain one of the following values:
The value of SIGSTKSZ is a system default specifying the number of bytes that would be used to cover the usual case when manually allocating an alternate stack area. The value MINSIGSTKSZ is defined to be the minimum stack size for a signal handler. In computing an alternate stack size, a program should add that amount to its stack requirements to allow for the system implementation overhead.
After a successful call to one of the exec functions, there are no alternate stacks in the new process image.
ss | A pointer to a stack_t structure specifying the alternate stack to use during signal handling. |
oss | A pointer to a stack_t structure that will indicate the alternate stack currently in use. |
Upon successful completion,
sigaltstack subroutine returns 0. Otherwise, it returns -1
and set errno to indicate the error.
-1 | Not successful and the errno global variable is set to one of the following error codes. |
The sigaction (sigaction, sigvec, or signal Subroutine) subroutine, sigsetjmp (sigsetjmp or siglongjmp Subroutine) subroutine.