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

439 lines
11 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>Qp0lGetPathFromFileID()--Get Path Name of Object from Its File
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: -->
<!-- file cleaned -->
<!-- Unix2 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- 011022 JTROUS Changes from API Review 1, V5R2 -->
<!-- 0206?? JET This file has undergone html cleanup -->
<!-- 050406 JTROUS: fix enums, no change flag, V5R4 -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!--End Header Records --><!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<a name="Top_Of_Page"></a>
<h2>Qp0lGetPathFromFileID()--Get Path Name of Object from Its File ID</h2>
<div class="box" style="width: 70%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;Qp0lstdi.h&gt;
char *Qp0lGetPathFromFileID(char <em>*buf</em>, size_t <em>size</em>,
Qp0lFID_t <em>fileid</em>);
</pre>
&nbsp;&nbsp;Service Program Name: QP0LLIB2<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>Qp0lGetPathFromFileID()</strong> function determines an absolute
path name of the file identified by <em>fileid</em> and stores it in <em>
buf</em>. The components of the returned path name are not symbolic links. If
the file has more than one path name, only one is returned.</p>
<p>The access time of each directory in the absolute path name of the file
(excluding the file itself) is updated.</p>
<p>If <em>buf</em> is a NULL pointer, <strong>Qp0lGetPathFromFileID()</strong>
returns a NULL pointer and the EINVAL error.</p>
<p>The contents of <em>buf</em> after an error are not defined.</p>
<p><strong>Qp0lGetPathFromFileID()</strong> is supported in the "root" (/),
QOpenSys, and user-defined file systems.</p>
<br>
<h3>Parameters</h3>
<dl>
<dt><strong><em>buf</em></strong></dt>
<dd>(Output) A pointer to a buffer that will be used to hold an absolute path
name of the file identified by <em>fileid</em>. The buffer must be large enough
to contain the full path name including the terminating NULL character.<br>
<br>
<p>The path name is returned in the CCSID (coded character set identifier)
currently in effect for the job. If the CCSID of the job is 65535, this
parameter is assumed to be represented in the default CCSID of the job.</p>
<p>See <a href="getpthffu.htm">QlgGetPathFromFileID()--Get Path Name of Object
from Its File ID (using NLS-enabled path name)</a> for a description and an
example of supplying the <em>buf</em> in any CCSID.</p>
<br>
</dd>
<dt><strong><em>size</em></strong></dt>
<dd>(Input) The number of bytes in the buffer <samp>buf</samp>.<br>
<br>
</dd>
<dt><strong><em>fileid</em></strong></dt>
<dd>(Input) The identifier of the file whose path name is to be returned. This
identifier is logged in audit journal entries to identify the file being
audited. See the <samp>Parent File ID</samp> and <samp>Object File ID</samp>
fields of the audit journal entries described in the <a href=
"../bookssc415302.pdf">iSeries Security Reference</a> <img src="wbpdf.gif"
alt="Link to PDF"> book.</dd>
</dl>
<br>
<h3>Authorities</h3>
<p><strong>Note:</strong> Adopted authority is not used.</p>
<strong><a name="TBLAGETPF">Authorization required for
Qp0lGetPathFromFileID()</a></strong>
<table border>
<tr>
<th align="left" valign="bottom">Object Referred to</th>
<th align="left" valign="bottom">Authority Required</th>
<th align="left" valign="bottom">errno</th>
</tr>
<tr>
<td align="left" valign="top">Each directory in the path name preceding the
file</td>
<td align="center" valign="top">*RX</td>
<td align="left" valign="top">EACCES</td>
</tr>
<tr>
<td align="left" valign="top">The file itself</td>
<td align="center" valign="top">*R</td>
<td align="left" valign="top">EACCES</td>
</tr>
</table>
<br>
<h3>Return Value</h3>
<dl compact>
<dt><em>value</em></dt>
<dd><strong>Qp0lGetPathFromFileID()</strong> was successful. The value returned
is a pointer to <em>buf</em>.</dd>
<dt><em>NULL</em></dt>
<dd><strong>Qp0lGetPathFromFileID()</strong> was not successful. The <em>
errno</em> global variable is set to indicate the error. After an error, the
contents of <em>buf</em> are not defined.</dd>
</dl>
<br>
<h3>Error Conditions</h3>
<p>If Qp0lGetPathFromFileID() is not successful, <em>errno</em> usually
indicates one of the following errors. Under some conditions, <em>errno</em>
could indicate an error other than those listed here.</p>
<table cellpadding="5">
<!-- cols="25 75" -->
<tr>
<th align="left" valign="bottom">Error condition</th>
<th align="left" valign="bottom">Additional information</th>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EACCES">EACCES</a>]</em></td>
<td align="left" valign="top">
<p>If you are accessing a remote file through the Network File System, update
operations to file permissions at the server are not reflected at the client
until updates to data that is stored locally by the Network File System take
place. (Several options on the Add Mounted File System (ADDMFS) command
determine the time between refresh operations of local data.) Access to a
remote file may also fail due to different mappings of user IDs (UID) or group
IDs (GID) on the local and remote systems.</p>
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EAGAIN">EAGAIN</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EBADFID">EBADFID</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EBUSY">EBUSY</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EDAMAGE">EDAMAGE</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EFAULT">EFAULT</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EFILECVT">EFILECVT</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EINVAL">EINVAL</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EIO">EIO</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#ENOENT">ENOENT</a>]</em></td>
<td align="left" valign="top">
<p>No path names were found for this <em>fileid</em> or the user is not
authorized to any of the paths.</p>
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#ENOMEM">ENOMEM</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#ENOTAVAIL">ENOTAVAIL</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#ERANGE">ERANGE</a>]</em></td>
<td align="left" valign="top">
<p>For example, the <strong>size</strong> argument is too small. It is greater than zero but
smaller than the length of the path name plus a NULL character.</p>
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#ESTALE">ESTALE</a>]</em></td>
<td align="left" valign="top">
<p>If you are accessing a remote file through the Network File System, the file
may have been deleted at the server.</p>
</td>
</tr>
<tr>
<td align="left" valign="top">
<em>[<a href="unix14.htm#EUNKNOWN">EUNKNOWN</a>]</em></td>
<td align="left" valign="top">
&nbsp;
</td>
</tr>
</table>
<br>
<br>
<h3>Error Messages</h3>
<p>The following messages may be sent from this function:</p>
<table width="100%">
<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 valign="top">CPFA0D4 E</td>
<td valign="top">File system error occurred. Error number &amp;1.</td>
</tr>
<tr>
<td valign="top">CPF3CF2 E</td>
<td valign="top">Error(s) occurred during running of &amp;1 API.</td>
</tr>
<tr>
<td valign="top">CPF9872 E</td>
<td valign="top">Program or service program &amp;1 in library &amp;2 ended.
Reason code &amp;3.</td>
</tr>
</table>
<br>
<br>
<h3>Usage Notes</h3>
<ol type="1">
<li>The following file systems do not support <strong>
Qp0lGetPathFromFileID()</strong>:<br>
<br>
</p>
<ul>
<li>Network File System</li>
<li>QSYS.LIB</li>
<li>Independent ASP QSYS.LIB</li>
<li>QDLS</li>
<li>QOPT</li>
<li>QFileSvr.400</li>
<li>QNetWare</li>
<li>QNTC</li>
</ul>
</li>
</ol>
<br>
<h3>Related Information</h3>
<ul>
<li>The &lt;<strong>Qp0lstdi.h</strong>&gt; file (see <a href="unix13.htm">
Header Files for UNIX-Type Functions</a>)
</li>
<li><a href="getpthffu.htm">QlgGetPathFromFileID()</a>--Get Path Name of Object
from Its File ID (using NLS-enabled path name)</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 determines the path name of a file, given its file ID.
In this example, the fileid is hardcoded. More realistically, the fileid is
obtained from the audit journal entry and passed to <strong>
Qp0lGetPathFromFileID()</strong>.</p>
<pre>
#include &lt;Qp0lstdi.h&gt;
#include &lt;stdio.h&gt;
main()
{
char path[1024];
Qp0lFID_t fileid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x80, 0xFF, 0xCF, 0x00};
if (Qp0lGetPathFromFileID(path, sizeof(path), fileid) == NULL)
perror("Qp0lGetPathFromFileID() error");
else
printf("The file's path is: %s\n", path);
}
</pre>
<p><strong>Output:</strong></p>
<pre>
The file's path is: /myfile
</pre>
<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>