[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions , Volume 2


sigstack Subroutine

Purpose

Sets and gets signal stack context.

Library

Standard C Library (libc.a)

Syntax


#include <signal.h>


int sigstack ( InStack, OutStack)
struct sigstack *InStack, *OutStack;

Description

The sigstack subroutine defines an alternate stack on which signals are to be processed.

When a signal occurs and its handler is to run on the signal stack, the system checks to see if the process is already running on that stack. If so, it continues to do so even after the handler returns. If not, the signal handler runs on the signal stack, and the original stack is restored when the handler returns.

Use the sigvec or sigaction subroutine to specify whether a given signal-handler routine is to run on the signal stack.

Attention: A signal stack does not automatically increase in size as a normal stack does. If the stack overflows, unpredictable results can occur.

Parameters


InStack Specifies the stack pointer of the new signal stack.

If the value of the InStack parameter is nonzero, 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 numerically greater addresses to lower ones, the stack pointer passed to the sigstack subroutine should point to the numerically high end of the stack area to be used. InStack->ss_onstack should be set to a value of 1 if the process is currently running on that stack; otherwise, it should be a value of 0.

If the value of the InStack parameter is 0 (that is, a null pointer), the signal stack state is not set.

OutStack Points to structure where current signal stack state is stored.

If the value of the OutStack parameter is nonzero, it points to a sigstack structure into which the sigstack subroutine stores the current signal stack state.

If the value of the OutStack parameter is 0, the previous signal stack state is not reported.

Return Values

Upon successful completion, the sigstack subroutine returns a value of 0. Otherwise, a value of -1 is returned and the errno global variable is set to indicate the error.

Error Codes

The sigstack subroutine is unsuccessful and the signal stack context remains unchanged if the following is true:

EFAULT The InStack or OutStack parameter points outside of the address space of the process.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

Thelongjmp (setjmp or longjmp Subroutine) subroutine, setjmp (setjmp or longjmp Subroutine) subroutine, sigaction, signal, or sigvec (sigaction, sigvec, or signal Subroutine) subroutine.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]