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

269 lines
6.8 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>givedescriptor()--Pass Descriptor Access to Another Job</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: -->
<!-- Unix8 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 -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!--End Header Records -->
<!-- Java sync-link -->
<script type="text/javascript" language="Javascript" src="../rzahg/synch.js">
</script>
<a name="Top_Of_Page"></a>
<h2>givedescriptor()--Pass Descriptor Access to Another Job</h2>
<div class="box" style="width: 60%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;sys/types.h&gt;
#include &lt;sys/socket.h&gt;
int givedescriptor(int <em>descriptor</em>,
char *<em>target_job</em>)
</pre>
<br>
&nbsp;&nbsp;Service Program Name: QSOSRV1<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 <em>givedescriptor()</em> function is used to pass a descriptor from one
i5/OS job to another i5/OS job.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong>descriptor</strong></dt>
<dd>(Input) The descriptor that is to be passed to the target job.<br>
<br>
</dd>
<dt><strong>target_job</strong></dt>
<dd>(Input) A pointer to the internal job identifier of the target job that is
to receive the descriptor referenced by the <em>descriptor</em> parameter.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p>To give a descriptor, the source thread must be running under one of the
following user profiles:</p>
<ul>
<li>A user profile that is the same as the job user identity of the target
job<br>
<br>
</li>
<li>A user profile that has all object (*ALLOBJ) special authority</li>
</ul>
<p>The <strong>job user identity</strong> is the name of the user profile by
which a job is known to other jobs. It is described in more detail in the
<a href="../rzaks/rzaks1.htm">Work Management</a> topic.</p>
<br>
<h3>Return Value</h3>
<p><em>givedescriptor()</em> returns an integer. Possible values are: </p>
<ul>
<li>-1 (unsuccessful)<br>
<br>
</li>
<li>0 (successful)</li>
</ul>
<br>
<h3>Error Conditions</h3>
<p>When <em>givedescriptor()</em> fails, <em>errno</em> can be set to one of
the following:</p>
<table cellpadding="5">
<!-- cols="15 85" -->
<tr>
<td align="left" valign="top"><em>[EACCES]</em></td>
<td align="left" valign="top">Permission denied.
<p>The job does not have the appropriate privileges required to give the
descriptor.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EBADF]</em></td>
<td align="left" valign="top">Descriptor not valid.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EFAULT]</em></td>
<td align="left" valign="top">Bad address.
<p>The system detected an address which was not valid while attempting to
access the <em>target_job</em> parameter.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EINVAL]</em></td>
<td align="left" valign="top">Parameter not valid.
<p>This error code indicates one of the following:</p>
<ul>
<li>The <em>target_job</em> parameter points to data that is not valid.<br>
<br>
</li>
<li>The <em>target_job</em> parameter refers to a job that is not active.</li>
</ul>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EIO]</em></td>
<td align="left" valign="top">Input/output error.<br>
<br>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EOPNOTSUPP]</em></td>
<td align="left" valign="top">Operation not supported.
<p>The underlying instance represented by the descriptor does not support
passing access rights.</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><em>[EUNKNOWN]</em></td>
<td align="left" valign="top">Unknown system state.</td>
</tr>
</table>
<br>
<br>
<h3>Error Messages</h3>
<table width="100%" cellpadding="5">
<!-- cols="15 85" -->
<tr>
<th align="left" valign="top">Message ID</th>
<th align="left" valign="top">Error Message Text</th>
</tr>
<tr>
<td width="15%" valign="top">CPE3418 E</td>
<td width="85%" valign="top">Possible APAR condition or hardware failure.</td>
</tr>
<tr>
<td align="left" valign="top">CPF9872 E</td>
<td align="left" valign="top">Program or service program &amp;1 in library
&amp;2 ended. Reason code &amp;3.</td>
</tr>
<tr>
<td align="left" valign="top">CPFA081 E</td>
<td align="left" valign="top">Unable to set return value or error code.</td>
</tr>
</table>
<br><br>
<h3><a name="USAGE_NOTES">Usage Notes</a></h3>
<ol>
<li>The information to specify in the <em>target_job</em> parameter can be
obtained in the actual target job by using a work management API (for example,
<strong>QUSRJOBI</strong>) to retrieve the <em>internal job identifier</em>.
<p>It is the responsibility of the application programmer to privately pass
this information from the target job to the job that issues the
<em>givedescriptor()</em>. One possible method that could be used to exchange
this information is to use data queues.</p>
</li>
<li>The <em>target_job</em> does not have to be waiting on a
<em>takedescriptor()</em> for the <em>givedescriptor()</em> to complete
successfully.<br>
<br>
</li>
<li>If both the job in which the <em>givedescriptor()</em> is issued and the
<em>target_job</em> end while a descriptor is in transit, the descriptor is
reclaimed by the system, and the resource that it represents is closed.<br>
<br>
</li>
<li>For files and directories, <em>givedescriptor()</em> is only supported for
objects in the
Root, QOpenSys, User-defined file systems (UDFS), and Network File System (NFS).
</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li><a href="tksoc.htm">takedescriptor()</a>--Receive Socket Access from Another
Job<br>
<br>
</li>
<li><a href="sendms.htm">sendmsg()</a>--Send Data or Descriptors or Both<br>
<br>
</li>
<li><a href="recvms.htm">recvmsg()</a>--Receive Data or Descriptors or Both<br>
<br>
</li>
<li><a href="spawn.htm">spawn()</a>--Spawn Process</li>
</ul>
<br>
<hr>
API introduced: V3R1
<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>