Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S

sigspace(2)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

sigspace — assure sufficient signal stack space

SYNOPSIS

#include <signal.h>

ssize_t sigspace(ssize_t stacksize);

DESCRIPTION

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() 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.

RETURN VALUE

Upon successful completion, sigspace() returns the size of the former guaranteed space. Otherwise, it returns -1 and sets errno to indicate the error.

ERRORS

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

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

Threads Considerations

Each thread may define an alternate signal handling stack.

LWP (Lightweight Processes) Considerations

Each LWP may define an alternate signal handling stack.

AUTHOR

sigspace() was developed by HP.

SEE ALSO

sigaction(2), sigstack(2), malloc(3C), setjmp(3C).

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.