sigstack
Purpose
Sets and gets signal stack context.
Syntax
#include <signal.h>
int sigstack (instack, outstack)
struct sigstack *instack, *outstack;
Description
The sigstack system call defines an alternate stack on
which signals are to be processed.
If the value of the instack parameter is nonzero, then 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 numer-
ically greater addresses to lower ones, the stack pointer
passed to the sigstack system call should point to the
numerically high end of the stack area to be used.
instack"->"ss_onstack should be set to 1 if the process
is currently executing on that stack; otherwise, it
should be 0.
If the value of the outstack parameter is nonzero, then
it points to a sigstack structure into which the sigstack
system call stores the current signal stack state.
If the value of the instack parameter is 0 (that is, a
NULL pointer), then the signal stack state is not set.
If the value of the outstack parameter is 0, then the
previous signal stack state is not reported.
When a signal occurs whose handler is to run on the
signal stack, the system checks to see if the process is
already executing on that stack. If so, then it con-
tinues to do so even after the handler returns. If not,
then the signal handler runs on the signal stack, and the
original stack is restored when the handler returns.
Use the sigvec system call to specify whether or not a
given signal's handler routine is to run on the signal
stack.
Warning: A signal stack does not automatically increase
in size as a normal stack does. If the stack overflows,
unpredictable results may occur.
Return Value
Upon successful completion, a value of 0 is returned. If
the sigstack system call fails, a value of -1 is returned
and errno is set to indicate the error.
Diagnostics
The sigstack system call fails and the signal stack
context remains unchanged if the following is true:
EFAULT The instack or outstack parameter &pointsout..
Related Information
In this book: "signal," "sigvec," and "setjmp, longjmp."