HP-UX Reference (11i v2 07/12) - 2 System Calls (vol 5)

s
sigstack(2) sigstack(2)
(TO BE OBSOLETED)
WARNINGS
Do not use sigstack() in conjunction with sigspace()
.
The direction of stack growth is not indicated in the historical definition of struct sigstack. The only way to
portably establish a stack pointer is for the application to determine stack growth direction, or to allocate a
block of storage and set the stack pointer to the middle. An application can assume that the size of the sig-
nal stack is
SIGSTKSZ. To specify a signal stack size other than
SIGSTKSZ, use the sigaltstack()
function.
Leaving the context of a service routine abnormally, such as by
longjmp() (see setjmp(3C)), might
remove the guarantee that the ordinary execution of the program does not extend into the guaranteed
space. It might also cause the program to lose forever its ability to automatically increase the stack size,
causing the program to be limited to the guaranteed space.
In HP-UX release 11.i, use of
sigstack() in threads created with process contention scope could result
in undefined behavior. This function will continue to be reliable in threads created with system contention
scope.
Obsolescent Interfaces
sigstack() is to be obsoleted at a future date.
APPLICATION USAGE
A portable application, when being written or rewritten, should use sigaltstack()
instead of sig-
stack()
.
On some implementations, stack space is automatically extended as needed. On those implementations,
automatic extension is typically not available for an alternate stack. If a signal stack overflows, the result-
ing behavior of the process is undefined.
The direction of stack growth is not indicated in the historical definition of struct sigstack. The only way to
portably establish a stack pointer is for the application to determine stack growth direction, or to allocate a
block of storage and set the stack pointer to the middle. The implementation may assume that the size of
the signal stack is
SIGSTKSZ as found in <signal.h> . An implementation that would like to specify a
signal stack size other than SIGSTKSZ should use sigaltstack()
.
Programs should not use
longjmp() to leave a signal handler that is running on a stack established with
sigstack() . Doing so may disable future use of the signal stack. For abnormal exit from a signal
handler, siglongjmp() , setcontext() ,orswapcontext()
may be used. These functions fully
support switching from one stack to another.
Threads Considerations
Each thread (with system contention scope) may define an alternate signal handling stack.
AUTHOR
sigstack() was developed by HP and the University of California, Berkeley.
SEE ALSO
exec(2), fork(2), setjmp(3C), sigaltstack(2), sigspace(2), signal(5), sigaction(2).
CHANGE HISTORY
First released in Issue 4, Version 2.
HP-UX 11i Version 2: December 2007 Update 2 Hewlett-Packard Company 433