8999 SMBIOS: cleanup 32-bit specific code
[unleashed.git] / usr / src / man / man3c / sigstack.3c
blobeca6515e6e17fe6bdbbf1ac09ab9d228f33383bf
1 '\" te
2 .\"  Copyright (c) 1992, X/Open Company Limited All Rights Reserved  Portions Copyright (c) 1996, Sun Microsystems, Inc.  All Rights Reserved
3 .\" 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
4 .\" http://www.opengroup.org/bookstore/.
5 .\" 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 Sun OS 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.
6 .\"  This notice shall appear on any product containing this material.
7 .\" 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.
8 .\" 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.
9 .\" 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]
10 .TH SIGSTACK 3C "Feb 28, 1996"
11 .SH NAME
12 sigstack \- set and/or get alternate signal stack context
13 .SH SYNOPSIS
14 .LP
15 .nf
16 #include <signal.h>
18 \fBint\fR \fBsigstack\fR(\fBstruct sigstack *\fR\fIss\fR, \fBstruct sigstack *\fR\fIoss\fR);
19 .fi
21 .SH DESCRIPTION
22 .sp
23 .LP
24 The \fBsigstack()\fR function allows the calling process to indicate to the
25 system an area of its address space to be used for processing signals received
26 by the process.
27 .sp
28 .LP
29 If the \fIss\fR argument is not a null pointer, it must point to a
30 \fBsigstack\fR structure. The length of the application-supplied stack must be
31 at least \fBSIGSTKSZ\fR bytes. If the alternate signal stack overflows, the
32 resulting behavior is undefined.  (See \fBUSAGE\fR below.)
33 .RS +4
34 .TP
35 .ie t \(bu
36 .el o
37 The value of the \fBss_onstack\fR member indicates whether the process wants
38 the system to use an alternate signal stack when delivering signals.
39 .RE
40 .RS +4
41 .TP
42 .ie t \(bu
43 .el o
44 The value of the \fBss_sp\fR member indicates the desired location of the
45 alternate signal stack area in the process' address space.
46 .RE
47 .RS +4
48 .TP
49 .ie t \(bu
50 .el o
51 If the \fIss\fR argument is a null pointer, the current alternate signal stack
52 context is not changed.
53 .RE
54 .sp
55 .LP
56 If the \fIoss\fR argument is not a null pointer, it points to a \fBsigstack\fR
57 structure in which the current alternate signal stack context is placed.  The
58 value stored in the \fBss_onstack\fR member of \fIoss\fR will be non-zero if
59 the process is currently executing on the alternate signal stack.  If the
60 \fIoss\fR argument is a null pointer, the current alternate signal stack
61 context is not returned.
62 .sp
63 .LP
64 When a signal's action indicates its handler should execute on the alternate
65 signal stack (specified by calling \fBsigaction\fR(2)), \fBsigstack()\fR checks
66 to see if the process is currently executing on that stack.  If the process is
67 not currently executing on the alternate signal stack, the system arranges a
68 switch to the alternate signal stack for the duration of the signal handler's
69 execution.
70 .sp
71 .LP
72 After a successful call to one of the \fIexec\fR functions, there are no
73 alternate signal stacks in the new process image.
74 .SH RETURN VALUES
75 .sp
76 .LP
77 Upon successful completion, \fBsigstack()\fR returns \fB0\fR.  Otherwise, it
78 returns \fB\(mi1\fR and sets \fBerrno\fR to indicate the error.
79 .SH ERRORS
80 .sp
81 .LP
82 The \fBsigstack()\fR function will fail if:
83 .sp
84 .ne 2
85 .na
86 \fB\fBEPERM\fR\fR
87 .ad
88 .RS 9n
89 An attempt was made to modify an active stack.
90 .RE
92 .SH USAGE
93 .sp
94 .LP
95 A portable application, when being written or rewritten, should use
96 \fBsigaltstack\fR(2) instead of \fBsigstack()\fR.
97 .sp
98 .LP
99 The direction of stack growth is not indicated in the historical definition of
100 \fBstruct sigstack\fR. The only way to portably establish a stack pointer is
101 for the application to determine stack growth direction, or to allocate a block
102 of storage and set the stack pointer to the middle. \fBsigstack()\fR may assume
103 that the size of the signal stack is \fBSIGSTKSZ\fR as found in
104 <\fBsignal.h\fR>. An application that would like to specify a signal stack size
105 other than \fBSIGSTKSZ\fR should use \fBsigaltstack\fR(2).
108 Applications should not use \fBlongjmp\fR(3C) to leave a signal handler that is
109 running on a stack established with \fBsigstack()\fR. Doing so may disable
110 future use of the signal stack.  For abnormal exit from a signal handler,
111 \fBsiglongjmp\fR(3C), \fBsetcontext\fR(2), or \fBswapcontext\fR(3C) may be
112 used. These functions fully support switching from one stack to another.
115 The \fBsigstack()\fR function requires the application to have knowledge of the
116 underlying system's stack architecture.  For this reason, \fBsigaltstack\fR(2)
117 is recommended over this function.
118 .SH SEE ALSO
121 \fBfork\fR(2), \fB_longjmp\fR(3C), \fBlongjmp\fR(3C), \fBsetjmp\fR(3C),
122 \fBsigaltstack\fR(2), \fBsiglongjmp\fR(3C), \fBsigsetjmp\fR(3C)