.\" .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for .\" permission to reproduce portions of its copyrighted documentation. .\" Original documentation from The Open Group can be obtained online at .\" http://www.opengroup.org/bookstore/. .\" .\" The Institute of Electrical and Electronics Engineers and The Open .\" Group, have given us permission to reprint portions of their .\" documentation. .\" .\" In the following statement, the phrase ``this text'' refers to portions .\" of the system documentation. .\" .\" Portions of this text are reprinted and reproduced in electronic form .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition, .\" Standard for Information Technology -- Portable Operating System .\" Interface (POSIX), The Open Group Base Specifications Issue 6, .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics .\" Engineers, Inc and The Open Group. In the event of any discrepancy .\" between these versions and the original IEEE and The Open Group .\" Standard, the original IEEE and The Open Group Standard is the referee .\" document. The original Standard can be obtained online at .\" http://www.opengroup.org/unix/online.html. .\" .\" This notice shall appear on any product containing this material. .\" .\" The contents of this file are subject to the terms of the .\" Common Development and Distribution License (the "License"). .\" You may not use this file except in compliance with the License. .\" .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE .\" or http://www.opensolaris.org/os/licensing. .\" See the License for the specific language governing permissions .\" and limitations under the License. .\" .\" When distributing Covered Code, include this CDDL HEADER in each .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. .\" If applicable, add the following below this CDDL HEADER, with the .\" fields enclosed by brackets "[]" replaced with your own identifying .\" information: Portions Copyright [yyyy] [name of copyright owner] .\" .\" .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved. .\" Portions Copyright (c) 1996, Sun Microsystems, Inc. All Rights Reserved .\" .TH SIGSTACK 3C "Feb 28, 1996" .SH NAME sigstack \- set and/or get alternate signal stack context .SH SYNOPSIS .LP .nf #include \fBint\fR \fBsigstack\fR(\fBstruct sigstack *\fR\fIss\fR, \fBstruct sigstack *\fR\fIoss\fR); .fi .SH DESCRIPTION .sp .LP The \fBsigstack()\fR 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. .sp .LP If the \fIss\fR argument is not a null pointer, it must point to a \fBsigstack\fR structure. The length of the application-supplied stack must be at least \fBSIGSTKSZ\fR bytes. If the alternate signal stack overflows, the resulting behavior is undefined. (See \fBUSAGE\fR below.) .RS +4 .TP .ie t \(bu .el o The value of the \fBss_onstack\fR member indicates whether the process wants the system to use an alternate signal stack when delivering signals. .RE .RS +4 .TP .ie t \(bu .el o The value of the \fBss_sp\fR member indicates the desired location of the alternate signal stack area in the process' address space. .RE .RS +4 .TP .ie t \(bu .el o If the \fIss\fR argument is a null pointer, the current alternate signal stack context is not changed. .RE .sp .LP If the \fIoss\fR argument is not a null pointer, it points to a \fBsigstack\fR structure in which the current alternate signal stack context is placed. The value stored in the \fBss_onstack\fR member of \fIoss\fR will be non-zero if the process is currently executing on the alternate signal stack. If the \fIoss\fR argument is a null pointer, the current alternate signal stack context is not returned. .sp .LP When a signal's action indicates its handler should execute on the alternate signal stack (specified by calling \fBsigaction\fR(2)), \fBsigstack()\fR 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. .sp .LP After a successful call to one of the \fIexec\fR functions, there are no alternate signal stacks in the new process image. .SH RETURN VALUES .sp .LP Upon successful completion, \fBsigstack()\fR returns \fB0\fR. Otherwise, it returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error. .SH ERRORS .sp .LP The \fBsigstack()\fR function will fail if: .sp .ne 2 .na \fB\fBEPERM\fR\fR .ad .RS 9n An attempt was made to modify an active stack. .RE .SH USAGE .sp .LP A portable application, when being written or rewritten, should use \fBsigaltstack\fR(2) instead of \fBsigstack()\fR. .sp .LP The direction of stack growth is not indicated in the historical definition of \fBstruct sigstack\fR. 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 middle. \fBsigstack()\fR may assume that the size of the signal stack is \fBSIGSTKSZ\fR as found in <\fBsignal.h\fR>. An application that would like to specify a signal stack size other than \fBSIGSTKSZ\fR should use \fBsigaltstack\fR(2). .sp .LP Applications should not use \fBlongjmp\fR(3C) to leave a signal handler that is running on a stack established with \fBsigstack()\fR. Doing so may disable future use of the signal stack. For abnormal exit from a signal handler, \fBsiglongjmp\fR(3C), \fBsetcontext\fR(2), or \fBswapcontext\fR(3C) may be used. These functions fully support switching from one stack to another. .sp .LP The \fBsigstack()\fR function requires the application to have knowledge of the underlying system's stack architecture. For this reason, \fBsigaltstack\fR(2) is recommended over this function. .SH SEE ALSO .sp .LP \fBfork\fR(2), \fB_longjmp\fR(3C), \fBlongjmp\fR(3C), \fBsetjmp\fR(3C), \fBsigaltstack\fR(2), \fBsiglongjmp\fR(3C), \fBsigsetjmp\fR(3C)