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

334 lines
8.4 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>Qp0sDisableSignals()--Disable 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>Qp0sDisableSignals()--Disable Process for Signals</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;signal.h&gt;
int Qp0sDisableSignals( 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>Qp0sDisableSignals()</strong> function prevents the process from
receiving signals.</p>
<p>After <strong>Qp0sDisableSignals()</strong> is called, the process is no
longer eligible to receive signals from another process or the system. Calls to
functions that examine the signal action or the signal blocking mask of the
thread will not return the requested information. For details on those
functions, see <a href="sigactn.htm">sigaction()--Examine and Change Signal
Action</a> and <a href="sigpmsk.htm">sigprocmask()--Examine and Change Blocked
Signals</a>.</p>
<p>If the process is currently disabled for signals, a call to <strong>
Qp0sDisableSignals()</strong> has no effect and an [ENOTSIGINIT] 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>Qp0sDisableSignals()</strong> was
successful.</td>
</tr>
<tr>
<td align="left" valign="top"><em>-1</em></td>
<td align="left" valign="top"><strong>Qp0sDisableSignals()</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>Qp0sDisableSignals()</strong> is not successful, <em>errno</em>
usually indicates the following error. Under some conditions, <em>errno</em>
could indicate an error other than that listed here.</p>
<dl>
<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.<br>
<br>
</li>
<li>The signal function is being called when the system signal controls have
not been initialized.</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. However, 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.
<p>Use of the following functions enables 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>The user of signals can prevent the signals from being delivered to the
process 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>. The
<strong>Qp0sDisableSignals()</strong> function provides a means of preventing
the calling process from receiving any signal from other processes or the
system.<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="sigesig.htm">Qp0sEnableSignals()</a>--Enable 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;time.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdio.h&gt;
void timestamp( char *str ) {
time_t t;
time( &amp;t );
printf( "%s the time is %s\n", str, ctime(&amp;t) );
}
int main( int argc, char * argv[] ) {
unsigned int ret;
timestamp( "before sleep()" );
/*
* The sleep() function implicitly enables the process to
* receive signals.
*/
ret = sleep( 10 );
timestamp( "after sleep()" );
printf( "sleep() returned %d\n", ret );
/*
* Qp0sDisableSignals() prevents the process from receiving
* signals. If the call to the Qp0sDisableSignals() function
* is not done, the process would remain eligible to receive
* signals after the return from main().
*/
Qp0sDisableSignals();
return( 0 );
}
</pre>
<br>
<h3>Output:</h3>
<pre>
before sleep() the time is Sun Jan 22 17:25:17 1995
after sleep() the time is Sun Jan 22 17:25:28 1995
sleep() returned 0
</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>