Sets and gets signal stack context.
Standard C Library (libc.a)
#include <signal.h> int sigstack (InStack, OutStack) struct sigstack *InStack, *OutStack;
The sigstack subroutine defines an alternate stack on which signals are to be processed.
When a signal occurs and its handler is to run on the signal stack, the system checks to see if the process is already running on that stack. If so, it continues to do so even after the handler returns. If not, the signal handler runs on the signal stack, and the original stack is restored when the handler returns.
Use the sigvec or sigaction subroutine to specify whether a given signal-handler routine is to run on the signal stack.
Attention: A signal stack does not automatically increase in size as a normal stack does. If the stack overflows, unpredictable results can occur.
|InStack|| Specifies the stack pointer of the new signal stack.
If the value of the InStack parameter is nonzero, it points to a sigstack structure, which has the following members:
caddr_t ss_sp; int ss_onstack;
The value of InStack -> ss_sp specifies the stack pointer of the new signal stack. Since stacks grow from numerically greater addresses to lower ones, the stack pointer passed to the sigstack subroutine should point to the numerically high end of the stack area to be used. InStack->ss_onstack should be set to a value of 1 if the process is currently running on that stack; otherwise, it should be a value of 0.
|OutStack||Points to structure where current signal stack state is stored.|
Upon successful completion, the sigstack subroutine returns a value of 0. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.
The sigstack subroutine is unsuccessful and the signal stack context remains unchanged if the following is true:
|EFAULT||The InStack or OutStack parameter points outside of the address space of the process.|
This subroutine is part of Base Operating System (BOS) Runtime.
Thelongjmp subroutine, setjmp subroutine, sigaction, signal, or sigvec subroutine.