The sigaltstack ( ) function allows
A process is able to define and examine the state of an alternate stack for signal handlers using
sigaltstack(). Signals shall be delivered on the alternate stack if they have been explicitly declared to
execute on the alternate stack. Unless it is a null pointer, ss points to a stack_t structure that
specifies the alternate signal stack that shall take effect upon return from sigaltstack ( ).
The stack is disabled and ss_sp and ss_size are ignored, if ss_flags is set to SS_DISABLE
The stack shall be enabled, and the ss_sp and ss_size members specify the new address
and size of the stack, if ss_flags is not set to SS_DISABLE.
The area of memory starting at ss_sp up to but not including ss_sp+ss_size is available to the
implementation for use as the stack.
On successful completion, oss shall point to a stack_t structure that if it's is not a null pointer.
It specifies the alternate signal stack that was in effect prior to the call to sigaltstack ( ).
The address and size of that stack are respectively the ss_sp and ss_size members.
When ss_flags is set to SS_ONSTACK, the process is currently executing on the alternate signal stack.
An attempt to modify the alternate signal stack while the process is executing on it will fail.
When ss_flags is set to SS_DISABLE, the alternate signal stack is currently disabled.
There are no alternate signal stacks in the new process image, after a successful call to one of the
exec functions.
sigaltstack ( ) shall return 0 upon successful completion,
sigaltstack shall return -1 and set errno to [EINVAL] if the ss argument is not a null pointer, and
the ss_flags member pointed to by ss contains flags other than SS_DISABLE.
sigaltstack shall return -1 and set errno to [ENOMEM] if The size of the alternate stack area is
less than MINSIGSTKSZ.
sigaltstack shall return -1 and set errno to [EPERM] An attempt was made to modify an active stack.