xref: /original-bsd/lib/libc/sys/sigstack.2 (revision 7f22226e)
1.\" Copyright (c) 1983, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)sigstack.2	6.5 (Berkeley) 03/10/91
7.\"
8.Dd
9.Dt SIGSTACK 2
10.Os BSD 4.2
11.Sh NAME
12.Nm sigstack
13.Nd set and/or get signal stack context
14.Sh SYNOPSIS
15.Fd #include <sys/signal.h>
16.Bd -literal
17struct sigstack {
18	caddr_t ss_sp;
19	int     ss_onstack;
20};
21.Ed
22.Ft int
23.Fn sigstack "const struct sigstack *ss" "struct sigstack *oss"
24.Sh DESCRIPTION
25.Fn Sigstack
26allows users to define an alternate stack on which signals
27are to be processed.  If
28.Fa ss
29is non-zero,
30it specifies a
31.Em "signal stack"
32on which to deliver signals
33and tells the system if the process is currently executing
34on that stack.  When a signal's action indicates its handler
35should execute on the signal stack (specified with a
36.Xr sigvec 2
37call), the system checks to see
38if the process is currently executing on that stack.  If the
39process is not currently executing on the signal stack,
40the system arranges a switch to the signal stack for the
41duration of the signal handler's execution.
42If
43.Fa oss
44is non-zero, the current signal stack state is returned.
45.Sh NOTES
46Signal stacks are not ``grown'' automatically, as is
47done for the normal stack.  If the stack overflows
48unpredictable results may occur.
49.Sh RETURN VALUES
50Upon successful completion, a value of 0 is returned.
51Otherwise, a value of -1 is returned and
52.Va errno
53is set to indicate the error.
54.Sh ERRORS
55.Fn Sigstack
56will fail and the signal stack context will remain unchanged
57if one of the following occurs.
58.Bl -tag -width [EFAULT]
59.It Bq Er EFAULT
60Either
61.Fa ss
62or
63.Fa oss
64points to memory that is not a valid part of the process
65address space.
66.El
67.Sh SEE ALSO
68.Xr sigvec 2 ,
69.Xr setjmp 3
70.Sh HISTORY
71The
72.Nm
73function call appeared in
74.Bx 4.2 .
75