657 lines
34 KiB
HTML
657 lines
34 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>System Interfaces Chapter 2</title>
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript" language="JavaScript" src="../jscript/codes.js">
|
|
</script>
|
|
|
|
<basefont size="3">
|
|
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001</font></center>
|
|
|
|
<hr size="2" noshade>
|
|
<h3><a name="tag_02_04"></a>Signal Concepts</h3>
|
|
|
|
<h4><a name="tag_02_04_01"></a>Signal Generation and Delivery</h4>
|
|
|
|
<p>A signal is said to be ``generated'' for (or sent to) a process or thread when the event that causes the signal first occurs.
|
|
Examples of such events include detection of hardware faults, timer expiration, <sup>[<a href=
|
|
"javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> signals
|
|
generated via the <b>sigevent</b> structure <img src="../images/opt-end.gif" alt="[Option End]" border="0"> and terminal activity,
|
|
as well as invocations of the <a href="../functions/kill.html"><i>kill</i>()</a> <sup>[<a href=
|
|
"javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> and <a href=
|
|
"../functions/sigqueue.html"><i>sigqueue</i>()</a> functions. <img src="../images/opt-end.gif" alt="[Option End]" border="0"> In
|
|
some circumstances, the same event generates signals for multiple processes.</p>
|
|
|
|
<p>At the time of generation, a determination shall be made whether the signal has been generated for the process or for a specific
|
|
thread within the process. Signals which are generated by some action attributable to a particular thread, such as a hardware
|
|
fault, shall be generated for the thread that caused the signal to be generated. Signals that are generated in association with a
|
|
process ID or process group ID or an asynchronous event, such as terminal activity, shall be generated for the process.</p>
|
|
|
|
<p>Each process has an action to be taken in response to each signal defined by the system (see <a href="#tag_02_04_03">Signal
|
|
Actions</a> ). A signal is said to be ``delivered'' to a process when the appropriate action for the process and signal is taken. A
|
|
signal is said to be ``accepted'' by a process when the signal is selected and returned by one of the <a href=
|
|
"../functions/sigwait.html"><i>sigwait</i>()</a> functions.</p>
|
|
|
|
<p>During the time between the generation of a signal and its delivery or acceptance, the signal is said to be ``pending''.
|
|
Ordinarily, this interval cannot be detected by an application. However, a signal can be ``blocked'' from delivery to a thread. If
|
|
the action associated with a blocked signal is anything other than to ignore the signal, and if that signal is generated for the
|
|
thread, the signal shall remain pending until it is unblocked, it is accepted when it is selected and returned by a call to the <a
|
|
href="../functions/sigwait.html"><i>sigwait</i>()</a> function, or the action associated with it is set to ignore the signal.
|
|
Signals generated for the process shall be delivered to exactly one of those threads within the process which is in a call to a <a
|
|
href="../functions/sigwait.html"><i>sigwait</i>()</a> function selecting that signal or has not blocked delivery of the signal. If
|
|
there are no threads in a call to a <a href="../functions/sigwait.html"><i>sigwait</i>()</a> function selecting that signal, and if
|
|
all threads within the process block delivery of the signal, the signal shall remain pending on the process until a thread calls a
|
|
<a href="../functions/sigwait.html"><i>sigwait</i>()</a> function selecting that signal, a thread unblocks delivery of the signal,
|
|
or the action associated with the signal is set to ignore the signal. If the action associated with a blocked signal is to ignore
|
|
the signal and if that signal is generated for the process, it is unspecified whether the signal is discarded immediately upon
|
|
generation or remains pending.</p>
|
|
|
|
<p>Each thread has a ``signal mask'' that defines the set of signals currently blocked from delivery to it. The signal mask for a
|
|
thread shall be initialized from that of its parent or creating thread, or from the corresponding thread in the parent process if
|
|
the thread was created as the result of a call to <a href="../functions/fork.html"><i>fork</i>()</a>. The <a href=
|
|
"../functions/pthread_sigmask.html"><i>pthread_sigmask</i>()</a>, <a href="../functions/sigaction.html"><i>sigaction</i>()</a>, <a
|
|
href="../functions/sigprocmask.html"><i>sigprocmask</i>()</a>, and <a href="../functions/sigsuspend.html"><i>sigsuspend</i>()</a>
|
|
functions control the manipulation of the signal mask.</p>
|
|
|
|
<p>The determination of which action is taken in response to a signal is made at the time the signal is delivered, allowing for any
|
|
changes since the time of generation. This determination is independent of the means by which the signal was originally generated.
|
|
If a subsequent occurrence of a pending signal is generated, it is implementation-defined as to whether the signal is delivered or
|
|
accepted more than once <sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> in circumstances other than those in which queuing is required under the Realtime Signals
|
|
Extension option. The order in which multiple, simultaneously pending signals outside the range SIGRTMIN to SIGRTMAX are delivered
|
|
to or accepted by a process is unspecified. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>When any stop signal (SIGSTOP, SIGTSTP, SIGTTIN, SIGTTOU) is generated for a process, any pending SIGCONT signals for that
|
|
process shall be discarded. Conversely, when SIGCONT is generated for a process, all pending stop signals for that process shall be
|
|
discarded. When SIGCONT is generated for a process that is stopped, the process shall be continued, even if the SIGCONT signal is
|
|
blocked or ignored. If SIGCONT is blocked and not ignored, it shall remain pending until it is either unblocked or a stop signal is
|
|
generated for the process.</p>
|
|
|
|
<p>An implementation shall document any condition not specified by this volume of IEEE Std 1003.1-2001 under which the
|
|
implementation generates signals.</p>
|
|
|
|
<h4><a name="tag_02_04_02"></a>Realtime Signal Generation and Delivery</h4>
|
|
|
|
<p><sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
This section describes extensions to support realtime signal generation and delivery. This functionality is dependent on support of
|
|
the Realtime Signals Extension option (and the rest of this section is not further marked for this option). <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>Some signal-generating functions, such as high-resolution timer expiration, asynchronous I/O completion, interprocess message
|
|
arrival, and the <a href="../functions/sigqueue.html"><i>sigqueue</i>()</a> function, support the specification of an
|
|
application-defined value, either explicitly as a parameter to the function or in a <b>sigevent</b> structure parameter. The
|
|
<b>sigevent</b> structure is defined in <a href="../basedefs/signal.h.html"><i><signal.h></i></a> and contains at least the
|
|
following members:</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Member Type</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Member Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>int</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>sigev_notify</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Notification type.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>int</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>sigev_signo</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Signal number.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>union sigval</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>sigev_value</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Signal value.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>void(*)(unsigned sigval)</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>sigev_notify_function</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Notification function.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>(pthread_attr_t*)</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>sigev_notify_attributes</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Notification attributes.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>The <i>sigev_notify</i> member specifies the notification mechanism to use when an asynchronous event occurs. This volume of
|
|
IEEE Std 1003.1-2001 defines the following values for the <i>sigev_notify</i> member:</p>
|
|
|
|
<dl compact>
|
|
<dt>SIGEV_NONE</dt>
|
|
|
|
<dd>No asynchronous notification shall be delivered when the event of interest occurs.</dd>
|
|
|
|
<dt>SIGEV_SIGNAL</dt>
|
|
|
|
<dd>The signal specified in <i>sigev_signo</i> shall be generated for the process when the event of interest occurs. If the
|
|
implementation supports the Realtime Signals Extension option and if the SA_SIGINFO flag is set for that signal number, then the
|
|
signal shall be queued to the process and the value specified in <i>sigev_value</i> shall be the <i>si_value</i> component of the
|
|
generated signal. If SA_SIGINFO is not set for that signal number, it is unspecified whether the signal is queued and what value,
|
|
if any, is sent.</dd>
|
|
|
|
<dt>SIGEV_THREAD</dt>
|
|
|
|
<dd>A notification function shall be called to perform notification.</dd>
|
|
</dl>
|
|
|
|
<p>An implementation may define additional notification mechanisms.</p>
|
|
|
|
<p>The <i>sigev_signo</i> member specifies the signal to be generated. The <i>sigev_value</i> member is the application-defined
|
|
value to be passed to the signal-catching function at the time of the signal delivery or to be returned at signal acceptance as the
|
|
<i>si_value</i> member of the <b>siginfo_t</b> structure.</p>
|
|
|
|
<p>The <b>sigval</b> union is defined in <a href="../basedefs/signal.h.html"><i><signal.h></i></a> and contains at least the
|
|
following members:</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Member Type</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Member Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>int</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>sival_int</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Integer signal value.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>void*</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>sival_ptr</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Pointer signal value.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>The <i>sival_int</i> member shall be used when the application-defined value is of type <b>int</b>; the <i>sival_ptr</i> member
|
|
shall be used when the application-defined value is a pointer.</p>
|
|
|
|
<p>When a signal is generated by the <a href="../functions/sigqueue.html"><i>sigqueue</i>()</a> function or any signal-generating
|
|
function that supports the specification of an application-defined value, the signal shall be marked pending and, if the SA_SIGINFO
|
|
flag is set for that signal, the signal shall be queued to the process along with the application-specified signal value. Multiple
|
|
occurrences of signals so generated are queued in FIFO order. It is unspecified whether signals so generated are queued when the
|
|
SA_SIGINFO flag is not set for that signal.</p>
|
|
|
|
<p>Signals generated by the <a href="../functions/kill.html"><i>kill</i>()</a> function or other events that cause signals to
|
|
occur, such as detection of hardware faults, <a href="../functions/alarm.html"><i>alarm</i>()</a> timer expiration, or terminal
|
|
activity, and for which the implementation does not support queuing, shall have no effect on signals already queued for the same
|
|
signal number.</p>
|
|
|
|
<p>When multiple unblocked signals, all in the range SIGRTMIN to SIGRTMAX, are pending, the behavior shall be as if the
|
|
implementation delivers the pending unblocked signal with the lowest signal number within that range. No other ordering of signal
|
|
delivery is specified.</p>
|
|
|
|
<p>If, when a pending signal is delivered, there are additional signals queued to that signal number, the signal shall remain
|
|
pending. Otherwise, the pending indication shall be reset.</p>
|
|
|
|
<p>Multi-threaded programs can use an alternate event notification mechanism. When a notification is processed, and the
|
|
<i>sigev_notify</i> member of the <b>sigevent</b> structure has the value SIGEV_THREAD, the function <i>sigev_notify_function</i>
|
|
is called with parameter <i>sigev_value</i>.</p>
|
|
|
|
<p>The function shall be executed in an environment as if it were the <i>start_routine</i> for a newly created thread with thread
|
|
attributes specified by <i>sigev_notify_attributes</i>. If <i>sigev_notify_attributes</i> is NULL, the behavior shall be as if the
|
|
thread were created with the <i>detachstate</i> attribute set to PTHREAD_CREATE_DETACHED. Supplying an attributes structure with a
|
|
<i>detachstate</i> attribute of PTHREAD_CREATE_JOINABLE results in undefined behavior. The signal mask of this thread is
|
|
implementation-defined.</p>
|
|
|
|
<h4><a name="tag_02_04_03"></a>Signal Actions</h4>
|
|
|
|
<p>There are three types of action that can be associated with a signal: SIG_DFL, SIG_IGN, or a pointer to a function. Initially,
|
|
all signals shall be set to SIG_DFL or SIG_IGN prior to entry of the <i>main</i>() routine (see the <i><a href=
|
|
"../functions/exec.html">exec</a></i> functions). The actions prescribed by these values are as follows:</p>
|
|
|
|
<dl compact>
|
|
<dt>SIG_DFL</dt>
|
|
|
|
<dd>Signal-specific default action.
|
|
|
|
<p>The default actions for the signals defined in this volume of IEEE Std 1003.1-2001 are specified under <a href=
|
|
"../basedefs/signal.h.html"><i><signal.h></i></a>. <sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src=
|
|
"../images/opt-start.gif" alt="[Option Start]" border="0"> If the Realtime Signals Extension option is supported, the default
|
|
actions for the realtime signals in the range SIGRTMIN to SIGRTMAX shall be to terminate the process abnormally. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>If the default action is to stop the process, the execution of that process is temporarily suspended. When a process stops, a
|
|
SIGCHLD signal shall be generated for its parent process, unless the parent process has set the SA_NOCLDSTOP flag. While a process
|
|
is stopped, any additional signals that are sent to the process shall not be delivered until the process is continued, except
|
|
SIGKILL which always terminates the receiving process. A process that is a member of an orphaned process group shall not be allowed
|
|
to stop in response to the SIGTSTP, SIGTTIN, or SIGTTOU signals. In cases where delivery of one of these signals would stop such a
|
|
process, the signal shall be discarded.</p>
|
|
|
|
<p>Setting a signal action to SIG_DFL for a signal that is pending, and whose default action is to ignore the signal (for example,
|
|
SIGCHLD), shall cause the pending signal to be discarded, whether or not it is blocked.</p>
|
|
|
|
<p>The default action for SIGCONT is to resume execution at the point where the process was stopped, after first handling any
|
|
pending unblocked signals. <sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt=
|
|
"[Option Start]" border="0"> If the Realtime Signals Extension option is supported, any queued values pending shall be
|
|
discarded and the resources used to queue them shall be released and returned to the system for other use. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
When a stopped process is continued, a SIGCHLD signal may be generated for its parent process, unless the parent process has set
|
|
the SA_NOCLDSTOP flag. <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
</dd>
|
|
|
|
<dt>SIG_IGN</dt>
|
|
|
|
<dd>Ignore signal.
|
|
|
|
<p>Delivery of the signal shall have no effect on the process. The behavior of a process is undefined after it ignores a SIGFPE,
|
|
SIGILL, SIGSEGV, <sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]"
|
|
border="0"> or SIGBUS <img src="../images/opt-end.gif" alt="[Option End]" border="0"> signal that was not generated by <a
|
|
href="../functions/kill.html"><i>kill</i>()</a>, <sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src=
|
|
"../images/opt-start.gif" alt="[Option Start]" border="0"> <a href="../functions/sigqueue.html"><i>sigqueue</i>()</a>, <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"> or <a href="../functions/raise.html"><i>raise</i>()</a>.</p>
|
|
|
|
<p>The system shall not allow the action for the signals SIGKILL or SIGSTOP to be set to SIG_IGN.</p>
|
|
|
|
<p>Setting a signal action to SIG_IGN for a signal that is pending shall cause the pending signal to be discarded, whether or not
|
|
it is blocked.</p>
|
|
|
|
<p>If a process sets the action for the SIGCHLD signal to SIG_IGN, the behavior is unspecified, <sup>[<a href=
|
|
"javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> except as
|
|
specified below.</p>
|
|
|
|
<p>If the action for the SIGCHLD signal is set to SIG_IGN, child processes of the calling processes shall not be transformed into
|
|
zombie processes when they terminate. If the calling process subsequently waits for its children, and the process has no
|
|
unwaited-for children that were transformed into zombie processes, it shall block until all of its children terminate, and <a href=
|
|
"../functions/wait.html"><i>wait</i>()</a>, <a href="../functions/waitid.html"><i>waitid</i>()</a>, and <a href=
|
|
"../functions/waitpid.html"><i>waitpid</i>()</a> shall fail and set <i>errno</i> to [ECHILD]. <img src="../images/opt-end.gif" alt=
|
|
"[Option End]" border="0"></p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
If the Realtime Signals Extension option is supported, any queued values pending shall be discarded and the resources used to queue
|
|
them shall be released and made available to queue other signals. <img src="../images/opt-end.gif" alt="[Option End]" border=
|
|
"0"></p>
|
|
</dd>
|
|
|
|
<dt><i>pointer to a function</i></dt>
|
|
|
|
<dd><br>
|
|
Catch signal.
|
|
|
|
<p>On delivery of the signal, the receiving process is to execute the signal-catching function at the specified address. After
|
|
returning from the signal-catching function, the receiving process shall resume execution at the point at which it was
|
|
interrupted.</p>
|
|
|
|
<p>If the SA_SIGINFO flag for the signal is cleared, the signal-catching function shall be entered as a C-language function call as
|
|
follows:</p>
|
|
|
|
<pre>
|
|
<tt>void</tt> <i>func</i><tt>(int</tt> <i>signo</i><tt>);
|
|
</tt>
|
|
</pre>
|
|
|
|
<p><sup>[<a href="javascript:open_code('XSI')">XSI|RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border=
|
|
"0"> If the SA_SIGINFO flag for the signal is set, the signal-catching function shall be entered as a C-language function call as
|
|
follows:</p>
|
|
|
|
<pre>
|
|
<tt>void</tt> <i>func</i><tt>(int</tt> <i>signo</i><tt>, siginfo_t *</tt><i>info</i><tt>, void *</tt><i>context</i><tt>);
|
|
</tt>
|
|
</pre>
|
|
|
|
<p>where <i>func</i> is the specified signal-catching function, <i>signo</i> is the signal number of the signal being delivered,
|
|
and <i>info</i> is a pointer to a <b>siginfo_t</b> structure defined in <a href=
|
|
"../basedefs/signal.h.html"><i><signal.h></i></a> containing at least the following members:</p>
|
|
|
|
<center>
|
|
<table border="1" cellpadding="3" align="center">
|
|
<tr valign="top">
|
|
<th align="center">
|
|
<p class="tent"><b>Member Type</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Member Name</b></p>
|
|
</th>
|
|
<th align="center">
|
|
<p class="tent"><b>Description</b></p>
|
|
</th>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>int</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>si_signo</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Signal number.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>int</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>si_code</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Cause of the signal.</p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><b>union sigval</b></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><i>si_value</i></p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent">Signal value.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</center>
|
|
|
|
<p>The <i>si_signo</i> member shall contain the signal number. This shall be the same as the <i>signo</i> parameter. The
|
|
<i>si_code</i> member shall contain a code identifying the cause of the signal. The following values are defined for
|
|
<i>si_code</i>:</p>
|
|
|
|
<dl compact>
|
|
<dt>SI_USER</dt>
|
|
|
|
<dd>The signal was sent by the <a href="../functions/kill.html"><i>kill</i>()</a> function. The implementation may set
|
|
<i>si_code</i> to SI_USER if the signal was sent by the <a href="../functions/raise.html"><i>raise</i>()</a> or <a href=
|
|
"../functions/abort.html"><i>abort</i>()</a> functions or any similar functions provided as implementation extensions. <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt>SI_QUEUE</dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The signal was sent by the <a href="../functions/sigqueue.html"><i>sigqueue</i>()</a> function. <img src="../images/opt-end.gif"
|
|
alt="[Option End]" border="0"></dd>
|
|
|
|
<dt>SI_TIMER</dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The signal was generated by the expiration of a timer set by <a href="../functions/timer_settime.html"><i>timer_settime</i>()</a>.
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0"></dd>
|
|
|
|
<dt>SI_ASYNCIO</dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The signal was generated by the completion of an asynchronous I/O request. <img src="../images/opt-end.gif" alt="[Option End]"
|
|
border="0"></dd>
|
|
|
|
<dt>SI_MESGQ</dt>
|
|
|
|
<dd><sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
The signal was generated by the arrival of a message on an empty message queue. <img src="../images/opt-end.gif" alt="[Option End]"
|
|
border="0"></dd>
|
|
</dl>
|
|
|
|
<p>If the signal was not generated by one of the functions or events listed above, the <i>si_code</i> shall be set to an
|
|
implementation-defined value that is not equal to any of the values defined above.</p>
|
|
|
|
<p><sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">
|
|
If the Realtime Signals Extension is supported, and <i>si_code</i> is one of SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ, then
|
|
<i>si_value</i> shall contain the application-specified signal value. Otherwise, the contents of <i>si_value</i> are undefined.
|
|
<img src="../images/opt-end.gif" alt="[Option End]" border="0"></p>
|
|
|
|
<p>The behavior of a process is undefined after it returns normally from a signal-catching function for a <sup>[<a href=
|
|
"javascript:open_code('XSI')">XSI</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> SIGBUS, <img
|
|
src="../images/opt-end.gif" alt="[Option End]" border="0"> SIGFPE, SIGILL, or SIGSEGV signal that was not generated by <a href=
|
|
"../functions/kill.html"><i>kill</i>()</a>, <sup>[<a href="javascript:open_code('RTS')">RTS</a>]</sup> <img src=
|
|
"../images/opt-start.gif" alt="[Option Start]" border="0"> <a href="../functions/sigqueue.html"><i>sigqueue</i>()</a>, <img src=
|
|
"../images/opt-end.gif" alt="[Option End]" border="0"> or <a href="../functions/raise.html"><i>raise</i>()</a>.</p>
|
|
|
|
<p>The system shall not allow a process to catch the signals SIGKILL and SIGSTOP.</p>
|
|
|
|
<p>If a process establishes a signal-catching function for the SIGCHLD signal while it has a terminated child process for which it
|
|
has not waited, it is unspecified whether a SIGCHLD signal is generated to indicate that child process.</p>
|
|
|
|
<p>When signal-catching functions are invoked asynchronously with process execution, the behavior of some of the functions defined
|
|
by this volume of IEEE Std 1003.1-2001 is unspecified if they are called from a signal-catching function.</p>
|
|
|
|
<p>The following table defines a set of functions that shall be either reentrant or non-interruptible by signals and shall be
|
|
async-signal-safe. Therefore applications may invoke them, without restriction, from signal-catching functions:</p>
|
|
|
|
<table cellpadding="3">
|
|
<tr valign="top">
|
|
<td align="left">
|
|
<p class="tent"><br>
|
|
<a href="../functions/_Exit.html"><i>_Exit</i>()</a><br>
|
|
<a href="../functions/_exit.html"><i>_exit</i>()</a><br>
|
|
<a href="../functions/accept.html"><i>accept</i>()</a><br>
|
|
<a href="../functions/access.html"><i>access</i>()</a><br>
|
|
<a href="../functions/aio_error.html"><i>aio_error</i>()</a><br>
|
|
<a href="../functions/aio_return.html"><i>aio_return</i>()</a><br>
|
|
<a href="../functions/aio_suspend.html"><i>aio_suspend</i>()</a><br>
|
|
<a href="../functions/alarm.html"><i>alarm</i>()</a><br>
|
|
<a href="../functions/bind.html"><i>bind</i>()</a><br>
|
|
<a href="../functions/cfgetispeed.html"><i>cfgetispeed</i>()</a><br>
|
|
<a href="../functions/cfgetospeed.html"><i>cfgetospeed</i>()</a><br>
|
|
<a href="../functions/cfsetispeed.html"><i>cfsetispeed</i>()</a><br>
|
|
<a href="../functions/cfsetospeed.html"><i>cfsetospeed</i>()</a><br>
|
|
<a href="../functions/chdir.html"><i>chdir</i>()</a><br>
|
|
<a href="../functions/chmod.html"><i>chmod</i>()</a><br>
|
|
<a href="../functions/chown.html"><i>chown</i>()</a><br>
|
|
<a href="../functions/clock_gettime.html"><i>clock_gettime</i>()</a><br>
|
|
<a href="../functions/close.html"><i>close</i>()</a><br>
|
|
<a href="../functions/connect.html"><i>connect</i>()</a><br>
|
|
<a href="../functions/creat.html"><i>creat</i>()</a><br>
|
|
<a href="../functions/dup.html"><i>dup</i>()</a><br>
|
|
<a href="../functions/dup2.html"><i>dup2</i>()</a><br>
|
|
<a href="../functions/execle.html"><i>execle</i>()</a><br>
|
|
<a href="../functions/execve.html"><i>execve</i>()</a><br>
|
|
<a href="../functions/fchmod.html"><i>fchmod</i>()</a><br>
|
|
<a href="../functions/fchown.html"><i>fchown</i>()</a><br>
|
|
<a href="../functions/fcntl.html"><i>fcntl</i>()</a><br>
|
|
<a href="../functions/fdatasync.html"><i>fdatasync</i>()</a><br>
|
|
<a href="../functions/fork.html"><i>fork</i>()</a><br>
|
|
</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><br>
|
|
<a href="../functions/fpathconf.html"><i>fpathconf</i>()</a><br>
|
|
<a href="../functions/fstat.html"><i>fstat</i>()</a><br>
|
|
<a href="../functions/fsync.html"><i>fsync</i>()</a><br>
|
|
<a href="../functions/ftruncate.html"><i>ftruncate</i>()</a><br>
|
|
<a href="../functions/getegid.html"><i>getegid</i>()</a><br>
|
|
<a href="../functions/geteuid.html"><i>geteuid</i>()</a><br>
|
|
<a href="../functions/getgid.html"><i>getgid</i>()</a><br>
|
|
<a href="../functions/getgroups.html"><i>getgroups</i>()</a><br>
|
|
<a href="../functions/getpeername.html"><i>getpeername</i>()</a><br>
|
|
<a href="../functions/getpgrp.html"><i>getpgrp</i>()</a><br>
|
|
<a href="../functions/getpid.html"><i>getpid</i>()</a><br>
|
|
<a href="../functions/getppid.html"><i>getppid</i>()</a><br>
|
|
<a href="../functions/getsockname.html"><i>getsockname</i>()</a><br>
|
|
<a href="../functions/getsockopt.html"><i>getsockopt</i>()</a><br>
|
|
<a href="../functions/getuid.html"><i>getuid</i>()</a><br>
|
|
<a href="../functions/kill.html"><i>kill</i>()</a><br>
|
|
<a href="../functions/link.html"><i>link</i>()</a><br>
|
|
<a href="../functions/listen.html"><i>listen</i>()</a><br>
|
|
<a href="../functions/lseek.html"><i>lseek</i>()</a><br>
|
|
<a href="../functions/lstat.html"><i>lstat</i>()</a><br>
|
|
<a href="../functions/mkdir.html"><i>mkdir</i>()</a><br>
|
|
<a href="../functions/mkfifo.html"><i>mkfifo</i>()</a><br>
|
|
<a href="../functions/open.html"><i>open</i>()</a><br>
|
|
<a href="../functions/pathconf.html"><i>pathconf</i>()</a><br>
|
|
<a href="../functions/pause.html"><i>pause</i>()</a><br>
|
|
<a href="../functions/pipe.html"><i>pipe</i>()</a><br>
|
|
<a href="../functions/poll.html"><i>poll</i>()</a><br>
|
|
<a href="../functions/posix_trace_event.html"><i>posix_trace_event</i>()</a><br>
|
|
<a href="../functions/pselect.html"><i>pselect</i>()</a><br>
|
|
</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><br>
|
|
<a href="../functions/raise.html"><i>raise</i>()</a><br>
|
|
<a href="../functions/read.html"><i>read</i>()</a><br>
|
|
<a href="../functions/readlink.html"><i>readlink</i>()</a><br>
|
|
<a href="../functions/recv.html"><i>recv</i>()</a><br>
|
|
<a href="../functions/recvfrom.html"><i>recvfrom</i>()</a><br>
|
|
<a href="../functions/recvmsg.html"><i>recvmsg</i>()</a><br>
|
|
<a href="../functions/rename.html"><i>rename</i>()</a><br>
|
|
<a href="../functions/rmdir.html"><i>rmdir</i>()</a><br>
|
|
<a href="../functions/select.html"><i>select</i>()</a><br>
|
|
<a href="../functions/sem_post.html"><i>sem_post</i>()</a><br>
|
|
<a href="../functions/send.html"><i>send</i>()</a><br>
|
|
<a href="../functions/sendmsg.html"><i>sendmsg</i>()</a><br>
|
|
<a href="../functions/sendto.html"><i>sendto</i>()</a><br>
|
|
<a href="../functions/setgid.html"><i>setgid</i>()</a><br>
|
|
<a href="../functions/setpgid.html"><i>setpgid</i>()</a><br>
|
|
<a href="../functions/setsid.html"><i>setsid</i>()</a><br>
|
|
<a href="../functions/setsockopt.html"><i>setsockopt</i>()</a><br>
|
|
<a href="../functions/setuid.html"><i>setuid</i>()</a><br>
|
|
<a href="../functions/shutdown.html"><i>shutdown</i>()</a><br>
|
|
<a href="../functions/sigaction.html"><i>sigaction</i>()</a><br>
|
|
<a href="../functions/sigaddset.html"><i>sigaddset</i>()</a><br>
|
|
<a href="../functions/sigdelset.html"><i>sigdelset</i>()</a><br>
|
|
<a href="../functions/sigemptyset.html"><i>sigemptyset</i>()</a><br>
|
|
<a href="../functions/sigfillset.html"><i>sigfillset</i>()</a><br>
|
|
<a href="../functions/sigismember.html"><i>sigismember</i>()</a><br>
|
|
<a href="../functions/sleep.html"><i>sleep</i>()</a><br>
|
|
<a href="../functions/signal.html"><i>signal</i>()</a><br>
|
|
<a href="../functions/sigpause.html"><i>sigpause</i>()</a><br>
|
|
<a href="../functions/sigpending.html"><i>sigpending</i>()</a><br>
|
|
</p>
|
|
</td>
|
|
<td align="left">
|
|
<p class="tent"><br>
|
|
<a href="../functions/sigprocmask.html"><i>sigprocmask</i>()</a><br>
|
|
<a href="../functions/sigqueue.html"><i>sigqueue</i>()</a><br>
|
|
<a href="../functions/sigset.html"><i>sigset</i>()</a><br>
|
|
<a href="../functions/sigsuspend.html"><i>sigsuspend</i>()</a><br>
|
|
<a href="../functions/socket.html"><i>socket</i>()</a><br>
|
|
<a href="../functions/socketpair.html"><i>socketpair</i>()</a><br>
|
|
<a href="../functions/stat.html"><i>stat</i>()</a><br>
|
|
<a href="../functions/symlink.html"><i>symlink</i>()</a><br>
|
|
<a href="../functions/sysconf.html"><i>sysconf</i>()</a><br>
|
|
<a href="../functions/tcdrain.html"><i>tcdrain</i>()</a><br>
|
|
<a href="../functions/tcflow.html"><i>tcflow</i>()</a><br>
|
|
<a href="../functions/tcflush.html"><i>tcflush</i>()</a><br>
|
|
<a href="../functions/tcgetattr.html"><i>tcgetattr</i>()</a><br>
|
|
<a href="../functions/tcgetpgrp.html"><i>tcgetpgrp</i>()</a><br>
|
|
<a href="../functions/tcsendbreak.html"><i>tcsendbreak</i>()</a><br>
|
|
<a href="../functions/tcsetattr.html"><i>tcsetattr</i>()</a><br>
|
|
<a href="../functions/tcsetpgrp.html"><i>tcsetpgrp</i>()</a><br>
|
|
<a href="../functions/time.html"><i>time</i>()</a><br>
|
|
<a href="../functions/timer_getoverrun.html"><i>timer_getoverrun</i>()</a><br>
|
|
<a href="../functions/timer_gettime.html"><i>timer_gettime</i>()</a><br>
|
|
<a href="../functions/timer_settime.html"><i>timer_settime</i>()</a><br>
|
|
<a href="../functions/times.html"><i>times</i>()</a><br>
|
|
<a href="../functions/umask.html"><i>umask</i>()</a><br>
|
|
<a href="../functions/uname.html"><i>uname</i>()</a><br>
|
|
<a href="../functions/unlink.html"><i>unlink</i>()</a><br>
|
|
<a href="../functions/utime.html"><i>utime</i>()</a><br>
|
|
<a href="../functions/wait.html"><i>wait</i>()</a><br>
|
|
<a href="../functions/waitpid.html"><i>waitpid</i>()</a><br>
|
|
<a href="../functions/write.html"><i>write</i>()</a><br>
|
|
</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<p>All functions not in the above table are considered to be unsafe with respect to signals. In the presence of signals, all
|
|
functions defined by this volume of IEEE Std 1003.1-2001 shall behave as defined when called from or interrupted by a
|
|
signal-catching function, with a single exception: when a signal interrupts an unsafe function and the signal-catching function
|
|
calls an unsafe function, the behavior is undefined.</p>
|
|
</dd>
|
|
</dl>
|
|
|
|
<p>When a signal is delivered to a thread, if the action of that signal specifies termination, stop, or continue, the entire
|
|
process shall be terminated, stopped, or continued, respectively.</p>
|
|
|
|
<h4><a name="tag_02_04_04"></a>Signal Effects on Other Functions</h4>
|
|
|
|
<p>Signals affect the behavior of certain functions defined by this volume of IEEE Std 1003.1-2001 if delivered to a
|
|
process while it is executing such a function. If the action of the signal is to terminate the process, the process shall be
|
|
terminated and the function shall not return. If the action of the signal is to stop the process, the process shall stop until
|
|
continued or terminated. Generation of a SIGCONT signal for the process shall cause the process to be continued, and the original
|
|
function shall continue at the point the process was stopped. If the action of the signal is to invoke a signal-catching function,
|
|
the signal-catching function shall be invoked; in this case the original function is said to be ``interrupted'' by the signal. If
|
|
the signal-catching function executes a <b>return</b> statement, the behavior of the interrupted function shall be as described
|
|
individually for that function, except as noted for unsafe functions. Signals that are ignored shall not affect the behavior of any
|
|
function; signals that are blocked shall not affect the behavior of any function until they are unblocked and then delivered,
|
|
except as specified for the <a href="../functions/sigpending.html"><i>sigpending</i>()</a> and <a href=
|
|
"../functions/sigwait.html"><i>sigwait</i>()</a> functions.</p>
|
|
|
|
<hr size="2" noshade>
|
|
<center><font size="2">UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
</font> [ <a href="../mindex.html">Main Index</a>]</center>
|
|
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|