sigspace(2) sigspace(2)
NAME [Toc] [Back]
sigspace - assure sufficient signal stack space
SYNOPSIS [Toc] [Back]
#include <signal.h>
ssize_t sigspace(ssize_t stacksize);
DESCRIPTION [Toc] [Back]
sigspace() requests additional stack space that is guaranteed to be
available for processing signals received by the calling process.
If the value of stacksize is positive, it specifies the size of a
space, in bytes, which the system guarantees to be available when
processing a signal. If the value of stacksize is zero, any guarantee
of space is removed. If the value is negative, the guarantee is left
unchanged; this can be used to interrogate the current guaranteed
value.
When a signal's action indicates that its handler should use the
guaranteed space (specified with a sigaction(), sigvector(), or
sigvec() call (see bsdproc(3C)), the system checks to see if the
process is currently using that space. If the process is not
currently using that space, the system arranges for that space to be
available for the duration of the signal handler's execution. If that
space has already been made available (due to a previous signal), no
change is made. Normal stack discipline is resumed when the signal
handler first using the guaranteed space is exited.
The guaranteed space is inherited by child processes resulting from a
successful fork() system call, but the guarantee of space is removed
after any exec() system call (see fork(2) and exec(2)).
The guaranteed space cannot be increased in size automatically, as is
done for the normal stack. If the stack overflows the guaranteed
space, the resulting behavior of the process is undefined.
Guaranteeing space for a stack can interfere with other memory
allocation routines in an implementation-dependent manner.
During normal execution of the program, the system checks for possible
overflow of the stack. Guaranteeing space might cause the space
available for normal execution to be reduced.
Leaving the context of a service routine abnormally, such as by
longjmp() (see setjmp(3C)), removes the guarantee that the ordinary
execution of the program will 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.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
sigspace(2) sigspace(2)
RETURN VALUE [Toc] [Back]
Upon successful completion, sigspace() returns the size of the former
guaranteed space. Otherwise, it returns -1 and sets errno to indicate
the error.
ERRORS [Toc] [Back]
sigspace() fails and the guaranteed amount of space remains unchanged
if the following occurs:
[ENOMEM] The requested space cannot be guaranteed,
either because of hardware limitations or
because some software-imposed limit would be
exceeded.
WARNINGS [Toc] [Back]
The guaranteed space is allocated using malloc(3C). This use might
interfere with other heap management mechanisms.
Methods for calculating the required size are not well developed.
Do not use sigspace() in conjunction with the facilities described
under sigset(3C).
Do not use sigspace() in conjunction with sigstack(2).
In HP-UX release 11.11, use of sigspace() 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.
APPLICATION USAGE [Toc] [Back]
Threads Considerations
Each thread may define an alternate signal handling stack.
LWP (Lightweight Processes) Considerations [Toc] [Back]
Each LWP may define an alternate signal handling stack.
AUTHOR [Toc] [Back]
sigspace() was developed by HP.
SEE ALSO [Toc] [Back]
sigaction(2), sigstack(2), sigvector(2), malloc(3C), setjmp(3C).
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003 [ Back ] |