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

356 lines
10 KiB
HTML

<!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>Qp0wChkPgrp()--Check Status for Process Group</title>
<!-- Begin Header Records ========================================== -->
<!-- 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. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- UNIX11 SCRIPT A converted by B2H R4.1 (346) (CMS) by V2DCIJB at -->
<!-- RCHVMW2 on 1 Jun 1999 at 16:14:12 -->
<!-- Edited by Kersten Feb 02 -->
<!-- This file has undergone html cleanup July 2002 by JET -->
<!-- End Header Records -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!--Java sync-link-->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>Qp0wChkPgrp()--Check Status for Process Group</h2>
<div class="box" style="width: 70%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;qp0wpid.h&gt;
int Qp0wChkPgrp(QP0W_PID_Entries_T *<em>mbrinfo</em>);
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QP0WPID<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>Qp0wChkPgrp()</strong> function returns the status and process
table entry information for the processes that are members of the process group
identified by <samp>pid</samp> in the structure <samp>
QP0W_PID_Entry_T</samp>.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong><em>*mbrinfo</em></strong></dt>
<dd>(I/O) A pointer to the <samp>QP0W_PID_Entry_T</samp> structure. This
structure contains the process table entry information for the processes that
are members of the process group identified by <samp>pid</samp>.</dd>
</dl>
<p>The structure <samp>QP0W_PID_Entry_T</samp> is defined in the <strong>
&lt;qp0wpid.h&gt;</strong> header file as follows:</p>
<pre>
typedef struct QP0W_PID_Entries_T {
int entries_prov;
int entries_could;
int entries_return;
pid_t pid;
QP0W_PID_Data_T entry[1];
} QP0W_PID_Entries_T;
</pre>
<p>The members of the <samp>QP0W_PID_Entry_T</samp> structure are as
follows:</p>
<table cellpadding="5">
<!-- cols="25 75" -->
<tr>
<td align="left" valign="top"><em>int entries_prov;</em></td>
<td align="left" valign="top">(Input) The number of entries of type <samp>
QP0W_PID_Data_T</samp> for which the caller has allocated storage to contain
the status and process table entry information.</td>
</tr>
<tr>
<td align="left" valign="top"><em>int entries_could;</em></td>
<td align="left" valign="top">(Output) The number of entries of type <samp>
QP0W_PID_Data_T</samp> that could be returned. If the <samp>
entries_could</samp> value exceeds the <samp>entries_prov</samp> value, the
<strong>Qp0wChkPgrp()</strong> function should be called again with sufficient
storage to contain the number of entries returned in <samp>entries_could</samp>
(<samp>entries_prov</samp> must be greater than or equal to <samp>
entries_could</samp>).</td>
</tr>
<tr>
<td align="left" valign="top"><em>int entries_return;</em></td>
<td align="left" valign="top">(Output) The number of entries of type <samp>
QP0W_PID_Data_T</samp> that were returned. If the <samp>entries_return</samp>
value is less than the <samp>entries_prov</samp> value, the content of the
excess number of entries provided is unchanged by <strong>
Qp0wChkPgrp()</strong>.</td>
</tr>
<tr>
<td align="left" valign="top"><em>pid_t pid;</em></td>
<td align="left" valign="top">(Input) The process group ID of the group of
processes for which the process information is to be returned.</td>
</tr>
<tr>
<td align="left" valign="top" nowrap><em>QP0W_PID_Data_T entry[1];</em></td>
<td align="left" valign="top">(Output) The process table information for the
process group members. There is one <samp>QP0W_PID_Data_T</samp> structure
entry for each process group member, limited by the value of <samp>
entries_prov</samp>.</td>
</tr>
</table>
<p>The structure <samp>QP0W_PID_Data_T</samp> is defined in the <strong>
&lt;qp0wpid.h&gt;</strong> file as follows:</p>
<pre>
typedef struct QP0W_PID_Data_T {
pid_t pid;
pid_t ppid;
pid_t pgrp;
int status;
unsigned int exit_status;
} QP0W_PID_Data_T;
</pre>
<p>The members of the <samp>QP0W_PID_Data_T</samp> structure are as
follows:</p>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top"><em>pid_t pid;</em></td>
<td align="left" valign="top">The process ID of the process.<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>pid_t ppid;</em></td>
<td align="left" valign="top">The process ID of the parent process. If <samp>
ppid</samp> has a value of binary 1, there is no parent process associated with
the process.</td>
</tr>
<tr>
<td align="left" valign="top"><em>pid_t pgrp;</em></td>
<td align="left" valign="top">The process group ID of the process.<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>int status;</em></td>
<td align="left" valign="top">A collection of flag bits that describe the
current state of the process. The following flag bits can be set in <samp>
status</samp>:<br>
<table cellpadding="5">
<tr>
<td align="left" valign="top"><em>QP0W_PID_TERMINATED</em></td>
<td align="left" valign="top">The process has ended.</td>
</tr>
<tr>
<td align="left" valign="top"><em>QP0W_PID_StopPED</em></td>
<td align="left" valign="top">The process was stopped by a signal.</td>
</tr>
<tr>
<td align="left" valign="top"><em>QP0W_PID_CHILDWAIT</em></td>
<td align="left" valign="top">The process is waiting for a child process to be
ended or stopped by a signal.</td>
</tr>
<tr>
<td align="left" valign="top"><em>QP0W_PID_SIGNALStop</em></td>
<td align="left" valign="top">The process has requested that the SIGCHLD signal
be generated for the process when one of its child processes is stopped by a
signal.</td>
</tr>
</table>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>unsigned int exit_status;</em></td>
<td align="left" valign="top">Exit status of the process. This member only has
meaning if the <samp>status</samp> is set to <samp>QP0W_PID_TERMINATED</samp>.
Refer to the <strong>wait()</strong> function for a description of the exit
status for a process.</td>
</tr>
</table>
<br>
<br>
<h3>Authorities</h3>
<p>The process calling <strong>Qp0wChkPgrp()</strong> must have the appropriate
authority to the processes being examined. A process is allowed to examine the
process table information for a process if at least one of the following
conditions is true:</p>
<ul>
<li>The process is calling <strong>Qp0wChkPgrp()</strong> for its own
process.<br>
<br>
</li>
<li>The process has *JOBCTL special authority defined in the process user
profile or in a current adopted user profile.<br>
<br>
</li>
<li>The process is the parent of the process (the process being examined has a
parent process ID equal to the process ID of the process calling <strong>
Qp0wChkPgrp()</strong>).<br>
<br>
</li>
<li>The real or effective user ID of the process matches the real or effective
user ID of the process calling <strong>Qp0wChkPgrp()</strong>.</li>
</ul>
<br>
<h3>Return Value</h3>
<table cellpadding="5">
<!-- cols="10 90" -->
<tr>
<td align="left" valign="top"><em>0</em></td>
<td align="left" valign="top"><strong>Qp0wChkPgrp()</strong> was
successful.</td>
</tr>
<tr>
<td align="left" valign="top"><em>value</em></td>
<td align="left" valign="top"><strong>Qp0wChkPgrp()</strong> was not
successful. The value returned indicates one of the following errors. Under
some conditions, <em>value</em> could indicate an error other than those listed
here.<br>
<br>
<table cellpadding="5">
<tr>
<td align="left" valign="top"><em>[EINVAL]</em></td>
<td align="left" valign="top">The value specified for the argument is not
correct.
<p>A function was passed incorrect argument values, or an operation was
attempted on an object and the operation specified is not supported for that
type of object.</p>
<p>An argument value is not valid, out of range, or NULL.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EPERM]</em></td>
<td align="left" valign="top">Operation not permitted.
<p>You must have appropriate privileges or be the owner of the object or other
resource to do the requested operation.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[ESRCH]</em></td>
<td align="left" valign="top">No item could be found that matches the specified
value.</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<br>
<h3>Usage Notes</h3>
<p>The <strong>Qp0wChkPgrp()</strong> function provides an i5/OS-specific way
to obtain the process table information for the members of a process group.</p>
<br>
<h3>Related Information</h3>
<ul class="noindent">
<li>The &lt;<strong>qp0wpid.h</strong>&gt; file (see <a href="unix13.htm">
Header Files for UNIX-Type Functions</a>)<br>
<br>
</li>
<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="getpgrp.htm">getpgrp()</a>--Get Process Group ID<br>
<br>
</li>
<li><a href="getpid.htm">getpid()</a>--Get Process ID<br>
<br>
</li>
<li><a href="getppid.htm">getppid()</a>--Get Process ID of Parent Process<br>
<br>
</li>
<li><a href="qgtpgrp.htm">Qp0wGetPgrp()</a>--Get Process Group ID<br>
<br>
</li>
<li><a href="qgtpid.htm">Qp0wGetPid()</a>--Get Process ID<br>
<br>
</li>
<li><a href="qgtppid.htm">Qp0wGetPPid()</a>--Get Process ID of Parent
Process<br>
<br>
</li>
<li><a href="wait.htm">wait()</a>--Wait for Child Process to End</li>
</ul>
<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>