summaryrefslogtreecommitdiff
path: root/usr/src/man/man3ucb/sigstack.3ucb
blob: 0964ca461a77bb174c44ddbfb76672462e0aa2e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
'\" te
.\"  Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved.
.\"  Copyright (c) 1983 Regents of the University of California.  All rights reserved.  The Berkeley software License Agreement specifies the terms and conditions for redistribution.
.TH sigstack 3UCB "30 Oct 2007" "SunOS 5.11" "SunOS/BSD Compatibility Library Functions"
.SH NAME
sigstack \- set and/or get signal stack context
.SH SYNOPSIS
.LP
.nf
\fB/usr/ucb/cc\fR [ \fIflag\fR ... ] \fIfile\fR ...
#include <signal.h>

\fBint\fR \fBsigstack\fR(\fInss\fR, \fIoss\fR)
\fBstruct sigstack *\fR\fInss\fR, \fB*\fR\fIoss\fR;
.fi

.SH DESCRIPTION
.sp
.LP
The \fBsigstack()\fR function allows users to define an alternate stack, called
the "signal stack", on which signals are to be processed.  When a signal's
action indicates its handler should execute on the signal stack (specified with
a \fBsigvec\fR(3UCB) call), 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.
.sp
.LP
A signal stack is specified by a \fBsigstack()\fR structure, which includes the
following members:
.sp
.in +2
.nf
char  *ss_sp;        /* signal stack pointer */
int   ss_onstack;    /* current status */
.fi
.in -2

.sp
.LP
The \fBss_sp\fR member is the initial value to be assigned to the stack pointer
when the system switches the process to the signal stack. Note that, on
machines where the stack grows downwards in memory, this is \fInot\fR the
address of the beginning of the signal stack area.  The \fBss_onstack\fR member
is zero or non-zero depending on whether the process is currently executing on
the signal stack or not.
.sp
.LP
If \fInss\fR is not a null pointer, \fBsigstack()\fR sets the signal stack
state to the value in the \fBsigstack()\fR structure pointed to by \fInss\fR.
If \fInss\fR is a \fBnull\fR pointer, the signal stack state will be unchanged.
If \fIoss\fR is not a \fBnull\fR pointer, the current signal stack state is
stored in the \fBsigstack()\fR structure pointed to by \fIoss\fR.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fB0\fR is returned.  Otherwise, \fB\(mi1\fR is
returned and \fBerrno\fR is set to indicate the error.
.SH ERRORS
.sp
.LP
The \fBsigstack()\fR function will fail and the signal stack context will
remain unchanged if one of the following occurs.
.sp
.ne 2
.mk
.na
\fB\fBEFAULT\fR\fR
.ad
.RS 10n
.rt  
Either \fInss\fR or \fIoss\fR points to memory that is not a valid part of the
process address space.
.RE

.SH SEE ALSO
.sp
.LP
\fBsigaltstack\fR(2), \fBsigvec\fR(3UCB), \fBsignal\fR(3C)
.SH WARNINGS
.sp
.LP
Signal stacks are not "grown" automatically, as is done for the normal stack.
If the stack overflows unpredictable results may occur.
.SH NOTES
.sp
.LP
Use of these interfaces should be restricted to only applications written on
BSD platforms.  Use of these interfaces with any of the system libraries or in
multi-threaded applications is unsupported.