1sigstack(3C)             Standard C Library Functions             sigstack(3C)
2
3
4

NAME

6       sigstack - set and/or get alternate signal stack context
7

SYNOPSIS

9       #include <signal.h>
10
11       int sigstack(struct sigstack *ss, struct sigstack *oss);
12
13

DESCRIPTION

15       The  sigstack()  function allows the calling process to indicate to the
16       system an area of its address space to be used for  processing  signals
17       received by the process.
18
19
20       If  the  ss argument is not a null pointer, it must point to a sigstack
21       structure. The length of the  application-supplied  stack  must  be  at
22       least  SIGSTKSZ  bytes.  If  the  alternate signal stack overflows, the
23       resulting behavior is undefined.  (See USAGE below.)
24
25           o      The value of the ss_onstack  member  indicates  whether  the
26                  process  wants  the  system to use an alternate signal stack
27                  when delivering signals.
28
29           o      The value of the ss_sp member indicates the desired location
30                  of  the  alternate signal stack area in the process' address
31                  space.
32
33           o      If the ss argument is a null pointer, the current  alternate
34                  signal stack context is not changed.
35
36
37       If  the  oss  argument  is  not a null pointer, it points to a sigstack
38       structure in which  the  current  alternate  signal  stack  context  is
39       placed.   The value stored in the ss_onstack member of oss will be non-
40       zero if the process is currently  executing  on  the  alternate  signal
41       stack.   If  the  oss argument is a null pointer, the current alternate
42       signal stack context is not returned.
43
44
45       When a signal's action indicates its  handler  should  execute  on  the
46       alternate  signal stack (specified by calling sigaction(2)), sigstack()
47       checks to see if the process is currently executing on that stack.   If
48       the  process  is not currently executing on the alternate signal stack,
49       the system arranges a switch to the  alternate  signal  stack  for  the
50       duration of the signal handler's execution.
51
52
53       After  a  successful  call  to  one of the exec functions, there are no
54       alternate signal stacks in the new process image.
55

RETURN VALUES

57       Upon  successful  completion,  sigstack()  returns  0.   Otherwise,  it
58       returns −1 and sets errno to indicate the error.
59

ERRORS

61       The sigstack() function will fail if:
62
63       EPERM    An attempt was made to modify an active stack.
64
65

USAGE

67       A  portable  application,  when  being written or rewritten, should use
68       sigaltstack(2) instead of sigstack().
69
70
71       The direction of stack growth is not indicated in the historical  defi‐
72       nition  of  struct sigstack. The only way to portably establish a stack
73       pointer is for the application to determine stack growth direction,  or
74       to allocate a block of storage and set the stack pointer to the middle.
75       sigstack() may assume that the size of the signal stack is SIGSTKSZ  as
76       found in <signal.h>. An application that would like to specify a signal
77       stack size other than SIGSTKSZ should use sigaltstack(2).
78
79
80       Applications should not use longjmp(3C) to leave a signal handler  that
81       is running on a stack established with sigstack(). Doing so may disable
82       future use of the signal stack.  For abnormal exit from a  signal  han‐
83       dler,  siglongjmp(3C),  setcontext(2),  or swapcontext(3C) may be used.
84       These functions fully support switching from one stack to another.
85
86
87       The sigstack() function requires the application to have  knowledge  of
88       the  underlying  system's stack architecture.  For this reason, sigalt‐
89       stack(2) is recommended over this function.
90

SEE ALSO

92       fork(2), _longjmp(3C), longjmp(3C),  setjmp(3C),  sigaltstack(2),  sig‐
93       longjmp(3C), sigsetjmp(3C)
94
95
96
97SunOS 5.11                        28 Feb 1996                     sigstack(3C)
Impressum