Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sigspace(2)

setjmp(3C)

sigstack(2)

NAME

sigstack − set and/or get signal stack context

SYNOPSIS

#include <signal.h>

int sigstack(

const struct sigstack *ss,
struct sigstack *oss

);

DESCRIPTION

sigstack() allows the calling process to indicate to the system an area of its address space to be used for processing signals received by the process. 

The correct use of sigstack() is hardware dependent, and therefore is not portable between different HP-UX implementations (see DEPENDENCIES below).  sigspace() is portable between different HP-UX implementations and should be used when the application does not need to know where the signal stack is located (see sigspace(2)). sigstack() is provided for compatability with other systems that provide this functionality.  Users should note that there is no guarantee that functionality similar to this is even possible on some architectures. 

If the value of the ss argument is not a null pointer, it is assumed to point to a struct sigstack structure, which includes the following members:

int ss_onstack; Non-zero when signal stack is in use. 

void *ss_sp; Signal stack pointer. 

The value of the ss_onstack member indicates whether the process wants the system to use a signal stack when delivering signals; the value of the ss_sp member indicates the desired location (see DEPENDENCIES) of the signal stack area in the process’s virtual address space. 

If the ss argument is a null pointer, the current signal stack context is not changed. 

If the oss argument is not a null pointer, it should point to a variable of type struct sigstack; the current signal stack context is returned in that variable.  The value stored in the ss_onstack member tells whether the process is currently using a signal stack, and if so, the value stored in the ss_sp member is the current stack pointer for the stack in use. 

If the oss argument is a null pointer, the current signal stack context is not returned. 

When a signal’s action indicates its handler should execute on the signal stack (specified by calling sigaction(), sigvector(), or sigvec() (see bsdproc(2))), the system checks to see if the process is currently executing on that stack. If the process is not currently executing on the signal stack, the system arranges a switch to the signal stack for the duration of the signal handler’s execution.

The signal stack context is inherited by child processes resulting from a successful fork() system call, but the context is removed after an exec() system call (see fork(2) and exec(2)).

RETURN VALUE

Upon successful completion, sigstack() returns 0; otherwise, it returns −1 and sets errno to indicate the error. 

ERRORS

sigstack() fails and the signal stack context remains unchanged if the following is true:

[EFAULT] Either of ss or oss is not a null pointer and points outside the allocated address space of the process.  The reliable detection of this error is implementation dependent. 

WARNINGS

Do not use sigstack(2) in conjunction with sigspace(2).

User-defined signal stacks do not grow automatically, as does the normal process stack.  If a signal stack overflows, the resulting behavior of the process is undefined. 

Methods for calculating the required stack size are not well developed. 

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.

DEPENDENCIES

Series 300/400

Stack addresses grow from high addresses to low addresses; therefore the signal stack address provided to sigstack(2) should point to the end of the space to be used for the signal stack. This address should be aligned to a four-byte boundary.

Series 700/800

Stack addresses grow from low addresses to high addresses; therefore the signal stack address provided to sigstack(2) should point to the beginning of the space to be used for the signal stack. This address should be aligned to an eight-byte boundary.

AUTHOR

sigstack() was developed by HP and the University of California, Berkeley. 

SEE ALSO

sigspace(2), setjmp(3C). 

Hewlett-Packard Company  —  HP-UX Release 9.0: August 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026