mirror of https://github.com/mkerrisk/man-pages
sigaltstack.2: Clarify that the alternate signal stack is per-thread
Clarify that the alternate signal stack is per-thread (rather than process-wide). Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
52e5819c41
commit
3b7d89960a
|
@ -49,7 +49,7 @@ _XOPEN_SOURCE\ >=\ 500
|
||||||
.ad
|
.ad
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR sigaltstack ()
|
.BR sigaltstack ()
|
||||||
allows a process to define a new alternate
|
allows a thread to define a new alternate
|
||||||
signal stack and/or retrieve the state of an existing
|
signal stack and/or retrieve the state of an existing
|
||||||
alternate signal stack.
|
alternate signal stack.
|
||||||
An alternate signal stack is used during the
|
An alternate signal stack is used during the
|
||||||
|
@ -153,15 +153,15 @@ address and size of that stack.
|
||||||
The \fIold_ss.ss_flags\fP may return either of the following values:
|
The \fIold_ss.ss_flags\fP may return either of the following values:
|
||||||
.TP
|
.TP
|
||||||
.B SS_ONSTACK
|
.B SS_ONSTACK
|
||||||
The process is currently executing on the alternate signal stack.
|
The thread is currently executing on the alternate signal stack.
|
||||||
(Note that it is not possible
|
(Note that it is not possible
|
||||||
to change the alternate signal stack if the process is
|
to change the alternate signal stack if the thread is
|
||||||
currently executing on it.)
|
currently executing on it.)
|
||||||
.TP
|
.TP
|
||||||
.B SS_DISABLE
|
.B SS_DISABLE
|
||||||
The alternate signal stack is currently disabled.
|
The alternate signal stack is currently disabled.
|
||||||
.IP
|
.IP
|
||||||
Alternatively, this value is returned if the process is currently
|
Alternatively, this value is returned if the thread is currently
|
||||||
executing on an alternate signal stack that was established using the
|
executing on an alternate signal stack that was established using the
|
||||||
.B SS_AUTODISARM
|
.B SS_AUTODISARM
|
||||||
flag.
|
flag.
|
||||||
|
@ -208,7 +208,7 @@ was less than
|
||||||
.TP
|
.TP
|
||||||
.B EPERM
|
.B EPERM
|
||||||
An attempt was made to change the alternate signal stack while
|
An attempt was made to change the alternate signal stack while
|
||||||
it was active (i.e., the process was already executing
|
it was active (i.e., the thread was already executing
|
||||||
on the current alternate signal stack).
|
on the current alternate signal stack).
|
||||||
.SH ATTRIBUTES
|
.SH ATTRIBUTES
|
||||||
For an explanation of the terms used in this section, see
|
For an explanation of the terms used in this section, see
|
||||||
|
@ -232,18 +232,18 @@ flag is a Linux extension.
|
||||||
The most common usage of an alternate signal stack is to handle the
|
The most common usage of an alternate signal stack is to handle the
|
||||||
.B SIGSEGV
|
.B SIGSEGV
|
||||||
signal that is generated if the space available for the
|
signal that is generated if the space available for the
|
||||||
normal process stack is exhausted: in this case, a signal handler for
|
standard stack is exhausted: in this case, a signal handler for
|
||||||
.B SIGSEGV
|
.B SIGSEGV
|
||||||
cannot be invoked on the process stack; if we wish to handle it,
|
cannot be invoked on the standard stack; if we wish to handle it,
|
||||||
we must use an alternate signal stack.
|
we must use an alternate signal stack.
|
||||||
.PP
|
.PP
|
||||||
Establishing an alternate signal stack is useful if a process
|
Establishing an alternate signal stack is useful if a thread
|
||||||
expects that it may exhaust its standard stack.
|
expects that it may exhaust its standard stack.
|
||||||
This may occur, for example, because the stack grows so large
|
This may occur, for example, because the stack grows so large
|
||||||
that it encounters the upwardly growing heap, or it reaches a
|
that it encounters the upwardly growing heap, or it reaches a
|
||||||
limit established by a call to \fBsetrlimit(RLIMIT_STACK, &rlim)\fP.
|
limit established by a call to \fBsetrlimit(RLIMIT_STACK, &rlim)\fP.
|
||||||
If the standard stack is exhausted, the kernel sends
|
If the standard stack is exhausted, the kernel sends
|
||||||
the process a \fBSIGSEGV\fP signal.
|
the thread a \fBSIGSEGV\fP signal.
|
||||||
In these circumstances the only way to catch this signal is
|
In these circumstances the only way to catch this signal is
|
||||||
on an alternate signal stack.
|
on an alternate signal stack.
|
||||||
.PP
|
.PP
|
||||||
|
@ -256,7 +256,7 @@ of the direction of stack growth.
|
||||||
Functions called from a signal handler executing on an alternate
|
Functions called from a signal handler executing on an alternate
|
||||||
signal stack will also use the alternate signal stack.
|
signal stack will also use the alternate signal stack.
|
||||||
(This also applies to any handlers invoked for other signals while
|
(This also applies to any handlers invoked for other signals while
|
||||||
the process is executing on the alternate signal stack.)
|
the thread is executing on the alternate signal stack.)
|
||||||
Unlike the standard stack, the system does not
|
Unlike the standard stack, the system does not
|
||||||
automatically extend the alternate signal stack.
|
automatically extend the alternate signal stack.
|
||||||
Exceeding the allocated size of the alternate signal stack will
|
Exceeding the allocated size of the alternate signal stack will
|
||||||
|
|
Loading…
Reference in New Issue