Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sigstack(3c) [opensolaris man page]

sigstack(3C)						   Standard C Library Functions 					      sigstack(3C)

NAME
sigstack - set and/or get alternate signal stack context SYNOPSIS
#include <signal.h> int sigstack(struct sigstack *ss, struct sigstack *oss); DESCRIPTION
The sigstack() function 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. If the ss argument is not a null pointer, it must point to a sigstack structure. The length of the application-supplied stack must be at least SIGSTKSZ bytes. If the alternate signal stack overflows, the resulting behavior is undefined. (See USAGE below.) o The value of the ss_onstack member indicates whether the process wants the system to use an alternate signal stack when deliver- ing signals. o The value of the ss_sp member indicates the desired location of the alternate signal stack area in the process' address space. o If the ss argument is a null pointer, the current alternate signal stack context is not changed. If the oss argument is not a null pointer, it points to a sigstack structure in which the current alternate signal stack context is placed. The value stored in the ss_onstack member of oss will be non-zero if the process is currently executing on the alternate signal stack. If the oss argument is a null pointer, the current alternate signal stack context is not returned. When a signal's action indicates its handler should execute on the alternate signal stack (specified by calling sigaction(2)), sigstack() checks to see if the process is currently executing on that stack. If the process is not currently executing on the alternate signal stack, the system arranges a switch to the alternate signal stack for the duration of the signal handler's execution. After a successful call to one of the exec functions, there are no alternate signal stacks in the new process image. RETURN VALUES
Upon successful completion, sigstack() returns 0. Otherwise, it returns -1 and sets errno to indicate the error. ERRORS
The sigstack() function will fail if: EPERM An attempt was made to modify an active stack. USAGE
A portable application, when being written or rewritten, should use sigaltstack(2) instead of sigstack(). 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 mid- dle. sigstack() may assume that the size of the signal stack is SIGSTKSZ as found in <signal.h>. An application that would like to specify a signal stack size other than SIGSTKSZ should use sigaltstack(2). Applications should not use longjmp(3C) to leave a signal handler that is running on a stack established with sigstack(). Doing so may dis- able future use of the signal stack. For abnormal exit from a signal handler, siglongjmp(3C), setcontext(2), or swapcontext(3C) may be used. These functions fully support switching from one stack to another. The sigstack() function requires the application to have knowledge of the underlying system's stack architecture. For this reason, sigalt- stack(2) is recommended over this function. SEE ALSO
fork(2), _longjmp(3C), longjmp(3C), setjmp(3C), sigaltstack(2), siglongjmp(3C), sigsetjmp(3C) SunOS 5.11 28 Feb 1996 sigstack(3C)

Check Out this Related Man Page

sigstack(2)							System Calls Manual						       sigstack(2)

NAME
sigstack - Sets and gets signal stack context SYNOPSIS
#include <signal.h> int sigstack ( struct sigstack *instack, struct sigstack *outstack ); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: sigstack(): XPG4-UNIX Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Points to the structure describing the new signal stack. Points to the structure where the current signal stack state is stored. DESCRIPTION
The sigstack() function defines an alternate stack on which signals are to be processed. If the value of the instack parameter is nonzero, it points to a sigstack() structure, which has the following members: struct sigstack{ caddr_t ss_sp; int ss_onstack; } The value of instack->ss_sp specifies the stack pointer of the new signal stack. The value of instack->ss_onstack should be set to 1 if the process is currently running on that stack; otherwise, it should be 0 (zero). If the value of the instack parameter is 0 (that is, a null pointer), the signal stack state is not set. If the value of the outstack parameter is nonzero, it points to a sigstack() structure into which the sigstack() function stores the cur- rent signal stack state. If the value of the outstack parameter is 0 (zero), the previous signal stack state is not reported. 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, the process continues to run on that stack 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 sigaction() function to specify whether a given signal handler routine is to run on the signal stack. NOTES
A signal stack does not automatically increase in size as a normal stack does. If the stack overflows, unpredictable results can occur. The sigstack() function is scheduled to be withdrawn from a future version of the X/Open CAE Specification. When writing or rewriting por- table applications, use the sigaltstack() function instead of sigstack(). RETURN VALUES
Upon successful completion, a value of 0 (zero) is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
The sigstack() function sets errno to the specified values for the following conditions: The instack or outstack parameter points outside of the address space of the process. RELATED INFORMATION
Functions: setjmp(3), sigaction(2), sigvec(2) Standards: standards(5) delim off sigstack(2)
Man Page