ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/sigesig.htm

308 lines
8.0 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>Qp0sEnableSignals()--Enable Process for Signals</title>
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Begin Header Records ========================================== -->
<!-- UNIX5 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- Edited by Kersten Feb 02 -->
<!--End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<a name="Top_Of_Page"></a>
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<h2>Qp0sEnableSignals()--Enable Process for Signals</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;signal.h&gt;
int Qp0sEnableSignals( void );
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QPOSSRV1<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Yes<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>Qp0sEnableSignals()</strong> function enables the process to
receive signals.</p>
<p>The <strong>Qp0sEnableSignals()</strong> function causes the process signal
vector to be initialized for the set of supported signals. The signal handling
action for each supported signal is set to the default action, as defined by
<strong>sigaction()</strong> (see <a href="sigactn.htm">sigaction()--Examine
and Change Signal Action</a>). The signal blocking mask of the calling thread
is set to the empty signal set (see <a href="sigeset.htm">
sigemptyset()--Initialize and Empty Signal Set</a>).</p>
<p>If the process is currently enabled for signals, a call to the <strong>
Qp0sEnableSignals()</strong> has no effect. That is, the process signal vector
and the signal blocking mask of the calling thread are unchanged and an
[EALREADY] error is returned.</p>
<br>
<!-- Please NOTE: DO NOT DELETE THIS SECTION if this API has no authorities and locks. -->
<!-- Instead, use the commented out coding below to indicate NONE. -->
<h3>Authorities and Locks</h3>
<!-- Use this if there are no authorities and locks. -->
<p>None.</p>
<br>
<h3>Parameters</h3>
<p>None</p>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="5 95" -->
<tr>
<td align="left" valign="top"><em>0</em></td>
<td align="left" valign="top"><strong>Qp0sEnableSignals()</strong> was
successful.</td>
</tr>
<tr>
<td align="left" valign="top"><em>-1</em></td>
<td align="left" valign="top"><strong>Qp0sEnableSignals()</strong> was not
successful. The <em>errno</em> variable is set to indicate the error.</td>
</tr>
</table>
<br>
<br>
<h3>Error Conditions</h3>
<p>If <strong>Qp0sEnableSignals()</strong> is not successful, <em>errno</em>
usually indicates one of the following errors. Under some conditions, <em>
errno</em> could indicate an error other than those listed here.</p>
<dl>
<dt><em>[EALREADY]</em></dt>
<dd>
<p>Operation already in progress.</p>
<p>The calling process is currently enabled for signals.</p>
</dd>
<dt><em>[ENOTSIGINIT]</em></dt>
<dd>
<p>Process not enabled for signals.</p>
<p>An attempt was made to call a signal function under one of the following
conditions:</p>
<ul>
<li>The signal function is being called for a process that is not enabled for
asynchronous signals.</li>
<li>The signal function is being called when the system signal controls have
not been initialized.</li>
<li style="list-style: none"><br>
</li>
</ul>
</dd>
</dl>
<br>
<h3>Usage Notes</h3>
<ol>
<li>Processes, by default, are not eligible to receive signals from other
processes or the system. The <strong>Qp0sEnableSignals</strong>() function
allows the calling process to receive signals from other processes or the
system without having to call other signal functions that enable the process
for signals.
<p>Use of the following functions enable a process for signals:</p>
<ul>
<li>alarm()</li>
<li>getpgrp()</li>
<li>getpid()</li>
<li>kill()</li>
<li>pause()</li>
<li>Qp0wGetPgrp()</li>
<li>Qp0wGetPid()</li>
<li>setitimer()</li>
<li>sigaction()</li>
<li>sigprocmask()</li>
<li>sigsuspend()</li>
<li>sigtimedwait()</li>
<li>sigwait()</li>
<li>sigwaitinfo()</li>
<li>sleep()</li>
</ul>
<p>Any of the Pthread APIs. See <a href="rzah4mst.htm">Pthread APIs</a> for
more information.</p>
</li>
<li>Once a process has been enabled for signals, it remains eligible to receive
signals until either it ends or some user action is taken to prevent the
delivery of signals. The user of signals can prevent the signals from being
delivered by calling the <strong>sigprocmask()</strong> function. The user can
also ignore the signal by calling the <strong>sigaction()</strong> function.
However, not all signals can be blocked or ignored. For details, see <a href=
"sigactn.htm">sigaction()--Examine and Change Signal Action</a> and <a href=
"sigpmsk.htm">sigprocmask()--Examine and Change Blocked Signals</a>.<br>
<br>
</li>
<li>If a process has not been enabled for signals, the signal blocking mask for
any thread created in the process will be set to the empty set.<br>
<br>
</li>
<li>If a process with multiple threads is disabled for signals by calling
<strong>Qp0sDisableSignals()</strong> and then later re-enabled for signals,
only the thread that causes signals to be enabled will have its signal blocking
mask changed. The signal blocking mask for all other threads will be the value
last used to set the signal blocking mask for those threads.</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li>The &lt;<strong>signal.h</strong>&gt; file (see <a href="unix13.htm">Header
Files for UNIX-Type Functions</a>)<br>
<br>
</li>
<li><a href="sigalarm.htm">alarm()</a>--Set Schedule for Alarm Signal<br>
<br>
</li>
<li><a href="sigkill.htm">kill()</a>--Send Signal to Process or Group of
Processes<br>
<br>
</li>
<li><a href="sigpause.htm">pause()</a>--Suspend Process Until Signal
Received<br>
<br>
</li>
<li><a href="sigdsig.htm">Qp0sDisableSignals()</a>--Disable Process for
Signals<br>
<br>
</li>
<li><a href="setitime.htm">setitimer()</a>--Set Value for Interval Timer<br>
<br>
</li>
<li><a href="sigactn.htm">sigaction()</a>--Examine and Change Signal Action<br>
<br>
</li>
<li><a href="sigpmsk.htm">sigprocmask()</a>--Examine and Change Blocked
Signals<br>
<br>
</li>
<li><a href="sigsusp.htm">sigsuspend()</a>--Wait for Signal<br>
<br>
</li>
<li><a href="sigtwait.htm">sigtimedwait()</a>--Synchronously Accept a Signal
for Interval of Time<br>
<br>
</li>
<li><a href="sigwait.htm">sigwait()</a>--Synchronously Accept a Signal<br>
<br>
</li>
<li><a href="sigwaiti.htm">sigwaitinfo()</a>--Synchronously Accept a Signal and
Signal Data<br>
<br>
</li>
<li><a href="sigsleep.htm">sleep()</a>--Suspend Processing for Interval of
Time</li>
</ul>
<br>
<h3>Example</h3>
<p>See <a href="../apiref/aboutapis.htm#codedisclaimer">Code disclaimer information</a>
for information pertaining to code examples.</p>
<p>The following example shows how a process can reset its signal vector and
signal blocking mask:</p>
<pre>
#include &lt;signal.h&gt;
#include &lt;errno.h&gt;
int resetSignals( void ) {
int return_value;
return_value = Qp0sEnableSignals();
if( return_value == -1 ) {
Qp0sDisableSignals();
return_value = Qp0sEnableSignals();
}
return( return_value );
}
</pre>
<br>
<hr>
API introduced: V3R6
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>