214 lines
5.8 KiB
HTML
214 lines
5.8 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>setpgid()--Set Process Group ID for Job Control</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 ========================================== -->
|
||
|
<!-- UNIX11 SCRIPT A converted by B2H R4.1 (346) (CMS) by V2DCIJB at -->
|
||
|
<!-- RCHVMW2 on 1 Jun 1999 at 16:14:12 -->
|
||
|
<!--End Header Records --><!-- Edited by Kersten Feb 02 -->
|
||
|
<!-- This file has undergone error condition cleanup JULY 2002 by JET -->
|
||
|
<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>setpgid()--Set Process Group ID for Job Control</h2>
|
||
|
|
||
|
<div class="box" style="width: 50%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
<pre>
|
||
|
#include <sys/types.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
int setpgid(pid_t <em>pid</em>, pid_t <em>pgid</em>);
|
||
|
</pre>
|
||
|
|
||
|
<br>
|
||
|
Service Program Name: QP0WSRV1<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Default Public Authority: *USE<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Threadsafe: Yes<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
</div>
|
||
|
|
||
|
<p>The <strong>setpgid()</strong> function is used to either join an existing
|
||
|
process group or create a new process group within the session of the calling
|
||
|
process.</p>
|
||
|
|
||
|
<p>See the <a href="#USGNOTE">Usage Notes</a> for considerations in using
|
||
|
<strong>setpgid()</strong>.</p>
|
||
|
|
||
|
<br>
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong><em>pid</em></strong></dt>
|
||
|
|
||
|
<dd>(Input) The process ID of the process whose process group ID is to be
|
||
|
changed. When <em>pid</em> has a value of zero, the process group ID of the
|
||
|
calling process is changed.<br>
|
||
|
<br>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong><em>pgid</em></strong></dt>
|
||
|
|
||
|
<dd>(Input) The process group ID to be assigned to the process whose process ID
|
||
|
matches <em>pid</em>. The value of <em>pgid</em> must be within the range of
|
||
|
zero through the maximum signed integer. When pgid/em> has a value of zero,
|
||
|
the process group ID is set to the process ID of the process indicated by <em>
|
||
|
pid</em>.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<br>
|
||
|
<h3>Authorities</h3>
|
||
|
|
||
|
<p>The process calling <strong>setpgid()</strong> must have the appropriate
|
||
|
authority to the process being changed. A process is allowed to access the
|
||
|
process group ID for a process if at least one of the following conditions is
|
||
|
true:</p>
|
||
|
|
||
|
<ul>
|
||
|
<li>The process is calling <strong>setpgid()</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>
|
||
|
setpgid()</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>setpgid()</strong>).</li>
|
||
|
</ul>
|
||
|
|
||
|
<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>setpgid()</strong> was successful.</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top"><em>-1</em></td>
|
||
|
<td align="left" valign="top"><strong>setpgid()</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>setpgid()</strong> is not successful, <em>errno</em> usually
|
||
|
indicates one of the following errors. Under some conditions, errno could
|
||
|
indicate an error other than that listed here.</p>
|
||
|
|
||
|
<dl>
|
||
|
<dt><em>[EINVAL]</em></dt>
|
||
|
|
||
|
<dd>
|
||
|
<p>The value specified for the argument is not correct.</p>
|
||
|
|
||
|
<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>
|
||
|
</dd>
|
||
|
|
||
|
<dt><em>[EPERM]</em></dt>
|
||
|
|
||
|
<dd>
|
||
|
<p>Operation not permitted.</p>
|
||
|
|
||
|
<p>You must have appropriate privileges or be the owner of the object or other
|
||
|
resource to do the requested operation.</p>
|
||
|
</dd>
|
||
|
|
||
|
<dt><em>[ESRCH]</em></dt>
|
||
|
|
||
|
<dd>
|
||
|
<p>No item could be found that matches the specified value.</p>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
|
||
|
<br>
|
||
|
|
||
|
|
||
|
<h3><a name="USGNOTE">Usage Notes</a></h3>
|
||
|
|
||
|
<ol>
|
||
|
<li>i5/OS does not support sessions. Until session support is available on
|
||
|
i5/OS, the restriction that the process group must be within the session of
|
||
|
the calling process will not be enforced.<br>
|
||
|
<br>
|
||
|
</li>
|
||
|
|
||
|
<li>The <strong>setpgid()</strong> function fails if a nonzero process group ID
|
||
|
is specified and that process group does not exist. If this occurs, the return
|
||
|
value is set to -1 and <em>errno</em> is set to [EPERM].</li>
|
||
|
</ol>
|
||
|
|
||
|
<br>
|
||
|
<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>unistd.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="qgtpgrp.htm">Qp0wGetPgrp()</a>--Get Process Group ID</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>
|
||
|
|