308 lines
8.4 KiB
HTML
308 lines
8.4 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>Qp0wChkPid()--Check Status for Process ID</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>Qp0wChkPid()--Check Status for Process ID</h2>
|
||
|
|
||
|
<div class="box" style="width: 70%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
<pre>
|
||
|
#include <sys/types.h>
|
||
|
#include <qp0wpid.h>
|
||
|
|
||
|
int Qp0wChkPid(pid_t <em>pid</em>,
|
||
|
QP0W_PID_Data_T *<em>pidinfo</em>);
|
||
|
</pre>
|
||
|
|
||
|
<br>
|
||
|
Service Program Name: QP0WPID<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Default Public Authority: *USE<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Threadsafe: Yes<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
</div>
|
||
|
|
||
|
<p>The <strong>Qp0wChkPid()</strong> function returns the status and process
|
||
|
table entry information for the process specified by the process ID
|
||
|
<em>pid</em>.</p>
|
||
|
|
||
|
<br>
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong><em>pid</em></strong></dt>
|
||
|
|
||
|
<dd>(Input) The process ID of the process whose process table information is to
|
||
|
be returned. When <em>pid</em> has a value of binary 0, the process table
|
||
|
information for the current process is returned.<br>
|
||
|
<br>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong><em>*pidinfo</em></strong></dt>
|
||
|
|
||
|
<dd>(Output) A pointer to the <samp>QP0W_PID_Data_T</samp> structure. The
|
||
|
process table entry information for the process identified by <em>pid</em> is
|
||
|
stored in the location pointed to by the <em>pidinfo</em> parameter.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<p>The structure <samp>QP0W_PID_Data_T</samp> is defined in
|
||
|
<strong><qp0wpid.h></strong> header 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.<br>
|
||
|
</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 has been 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 it's child processes has been 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> has been set to
|
||
|
<samp>QP0W_PID_TERMINATED</samp>. Refer to the <strong>wait</strong>() function
|
||
|
for a description of the exit status for a process.<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<br>
|
||
|
<br>
|
||
|
<h3>Authorities</h3>
|
||
|
|
||
|
<p>The process calling <strong>Qp0wChkPid()</strong> must have the appropriate
|
||
|
authority to the process 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>Qp0wChkPid()</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>Qp0wChkPid()</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>Qp0wChkPid()</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>Qp0wChkPid()</strong> was
|
||
|
successful.</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top"><em>value</em></td>
|
||
|
<td align="left" valign="top"><strong>Qp0wChkPid()</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>
|
||
|
|
||
|
<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>Qp0wChkPid()</strong> function provides an i5/OS-specific way
|
||
|
to obtain the process table information for the specified process.</p>
|
||
|
|
||
|
<h3>Related Information</h3>
|
||
|
|
||
|
<ul>
|
||
|
<li>The <<strong>sys/types.h</strong>> file (see <a href=
|
||
|
"unix13.htm">Header Files for UNIX-Type Functions</a>)<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li>The <<strong>qp0wpid.h</strong>> file (see <a href="unix13.htm">Header
|
||
|
Files for UNIX-Type Functions</a>)<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li>The <<strong>signal.h</strong>> 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>
|
||
|
|