424 lines
13 KiB
HTML
424 lines
13 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>stat64()--Get File Information (Large File Enabled)</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. -->
|
||
|
<!-- Unix2 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
|
||
|
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
|
||
|
<!-- Change History: -->
|
||
|
<!-- YYMMDD USERID Change description -->
|
||
|
<!-- 010411 JTROUS Add new field descriptions, V5R2, 98391 -->
|
||
|
<!-- 010503 JTROUS Add new field desc nlink32, V5R2a, 98761 -->
|
||
|
<!-- 0206?? JET This file has undergone html cleanup June 2002 by JET -->
|
||
|
<!-- 021107 JTROUS Add desc to blksize,allocsize, V5R3 -->
|
||
|
<!-- 040206 TIMCLARK: Update stat64 structure with st_vfs, V5R4 -->
|
||
|
<!-- 040721 JTROUS: fix OS/400 reference, no change flag, V5R4 -->
|
||
|
<!--End Header Records -->
|
||
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
||
|
</head>
|
||
|
<body><!-- Java sync-link -->
|
||
|
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
|
||
|
</script>
|
||
|
|
||
|
<a name="Top_Of_Page"></a>
|
||
|
|
||
|
<h2>stat64()--Get File Information (Large File Enabled)</h2>
|
||
|
|
||
|
<div class="box" style="width: 60%;">
|
||
|
<br>
|
||
|
Syntax<br>
|
||
|
|
||
|
|
||
|
<pre>
|
||
|
#include <sys/stat.h>
|
||
|
|
||
|
int stat64(const char <em>*path</em>, struct stat64 <em>*buf</em>);
|
||
|
</pre>
|
||
|
|
||
|
Service Program Name: QP0LLIB1<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Default Public Authority: *USE<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
Threadsafe: Conditional; see <a href="#USAGE_NOTES">Usage Notes</a>.<br>
|
||
|
<!-- iddvc RMBR -->
|
||
|
<br>
|
||
|
</div>
|
||
|
|
||
|
<p>The <strong>stat64()</strong> function gets status information about a
|
||
|
specified file and places it in the area of memory pointed to by the <em>
|
||
|
buf</em> argument.</p>
|
||
|
|
||
|
<p>If the named file is a symbolic link, <strong>stat64()</strong> resolves the
|
||
|
symbolic link. It also returns information about the resulting file.</p>
|
||
|
|
||
|
<p><strong>stat64()</strong> is enabled for large files. It is capable of
|
||
|
operating on files larger than 2GB minus 1 byte and returning correct
|
||
|
sizes.</p>
|
||
|
|
||
|
<p>For additional information about authorities required, error conditions, and
|
||
|
examples, see <a href="stat.htm">stat()</a>--Get File Information.</p>
|
||
|
|
||
|
<br>
|
||
|
<h3>Parameters</h3>
|
||
|
|
||
|
<dl>
|
||
|
<dt><strong><em>path</em></strong></dt>
|
||
|
|
||
|
<dd>(Input) A pointer to the null-terminated path name of the file from which
|
||
|
information is required.
|
||
|
|
||
|
<p>This parameter is assumed to be represented 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="stat64u.htm">QlgStat64()--Get File Information (large file
|
||
|
enabled and using NLS-enabled path name)</a> for a description and an example
|
||
|
of supplying the <em>path</em> in any CCSID.</p>
|
||
|
|
||
|
<br>
|
||
|
</dd>
|
||
|
|
||
|
<dt><strong><em>buf</em></strong></dt>
|
||
|
|
||
|
<dd>(Output) A pointer to the area to which the information should be
|
||
|
written.</dd>
|
||
|
</dl>
|
||
|
|
||
|
<p>The information is returned in the following <samp>stat64</samp> structure,
|
||
|
as defined in the <<strong>sys/stat.h</strong>> header file:</p>
|
||
|
|
||
|
<table border>
|
||
|
<tr>
|
||
|
<td align="left" valign="top" width="15%">mode_t</td>
|
||
|
<td align="left" valign="top" width="20%">st_mode</td>
|
||
|
<td align="left" valign="top" width="75%">A bit string indicating the
|
||
|
permissions and privileges of the file. Symbols are defined in the
|
||
|
<sys/stat.h> header file to refer to bits in a mode_t value; these
|
||
|
symbols are listed in <a href="chmod.htm">chmod()--Change File
|
||
|
Authorizations</a>.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">ino_t</td>
|
||
|
<td align="left" valign="top">st_ino</td>
|
||
|
<td align="left" valign="top">The file ID for the object. This number uniquely
|
||
|
identifies the object within a file system. When st_ino and st_dev are used
|
||
|
together, they uniquely identify the object on the system.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">uid_t</td>
|
||
|
<td align="left" valign="top">st_uid</td>
|
||
|
<td align="left" valign="top">The numeric user ID (uid) of the owner of the
|
||
|
file.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">gid_t</td>
|
||
|
<td align="left" valign="top">st_gid</td>
|
||
|
<td align="left" valign="top">The numeric group ID (GID) for the file.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">off64_t</td>
|
||
|
<td align="left" valign="top">st_size</td>
|
||
|
<td align="left" valign="top">Defined as follows for each file type:
|
||
|
|
||
|
<dl compact>
|
||
|
<dt><em>Regular File</em></dt>
|
||
|
|
||
|
<dd>The number of data bytes in the file.</dd>
|
||
|
|
||
|
<dt><em>Directory</em></dt>
|
||
|
|
||
|
<dd>The number of bytes allocated to the directory.</dd>
|
||
|
|
||
|
<dt><em>Symbolic Link</em></dt>
|
||
|
|
||
|
<dd>The number of bytes in the path name stored in the symbolic link.</dd>
|
||
|
|
||
|
<dt><em>Local Socket</em></dt>
|
||
|
|
||
|
<dd>Always zero.</dd>
|
||
|
|
||
|
<dt><em>Operating System Native Object</em></dt>
|
||
|
|
||
|
<dd>This value is dependent on the object type.</dd>
|
||
|
</dl>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">time_t</td>
|
||
|
<td align="left" valign="top">st_atime</td>
|
||
|
<td align="left" valign="top">The most recent time the file was accessed.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">time_t</td>
|
||
|
<td align="left" valign="top">st_mtime</td>
|
||
|
<td align="left" valign="top">The most recent time the contents of the file
|
||
|
were changed.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">time_t</td>
|
||
|
<td align="left" valign="top">st_ctime</td>
|
||
|
<td align="left" valign="top">The most recent time the status of the file was
|
||
|
changed.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">dev_t</td>
|
||
|
<td align="left" valign="top">st_dev</td>
|
||
|
<td align="left" valign="top">The file system ID to which the object belongs.
|
||
|
This number uniquely identifies the file system to which the object belongs.
|
||
|
When st_ino and st_dev are used together, they uniquely identify the object on
|
||
|
the system. This field will be 4,294,967,295 if the value could not fit in the
|
||
|
specified dev_t field. The complete value will be in the st_dev64 field.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">size_t</td>
|
||
|
<td align="left" valign="top">st_blksize</td>
|
||
|
<td align="left" valign="top">The block size of the file in bytes.
|
||
|
This number is the number of bytes in a block of disk unit storage.
|
||
|
<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">nlink_t</td>
|
||
|
<td align="left" valign="top">st_nlink</td>
|
||
|
<td align="left" valign="top">The number of links to the file. This field will
|
||
|
be 65,535 if the value could not fit in the specified nlink_t field. The
|
||
|
complete value will be in the st_nlink32 field.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">unsigned short</td>
|
||
|
<td align="left" valign="top">st_codepage</td>
|
||
|
<td align="left" valign="top">The code page derived from the CCSID used for the
|
||
|
data in the file or the extended attributes of the directory. If the returned
|
||
|
value of this field is 0, a code page could not be derived.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">unsigned long long</td>
|
||
|
<td align="left" valign="top">st_allocsize</td>
|
||
|
<td align="left" valign="top">The number of bytes allocated to the file.
|
||
|
The allocated size varies by object type and file system. For example, the
|
||
|
allocated size includes the object data size as shown in st_size as well as any
|
||
|
logically sized extents to accomodate anticipated future requirements for
|
||
|
the object data. It may or may not include additional bytes for attribute
|
||
|
information.
|
||
|
<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">unsigned int</td>
|
||
|
<td align="left" valign="top">st_ino_gen_id</td>
|
||
|
<td align="left" valign="top">The generation ID associated with the file
|
||
|
ID.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">qp0l_objtype_t</td>
|
||
|
<td align="left" valign="top">st_objtype</td>
|
||
|
<td align="left" valign="top">The object type; for example, *STMF or
|
||
|
*DIR. Refer to <a href="../rbam6/clpro.htm">CL Programming</a> topic for a list of the
|
||
|
object types.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">char</td>
|
||
|
<td align="left" valign="top">st_reserved2[5]</td>
|
||
|
<td align="left" valign="top">Reserved.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">dev-t</td>
|
||
|
<td align="left" valign="top">st_rdev</td>
|
||
|
<td align="left" valign="top">The device ID of the object if the object is a
|
||
|
character special file or block special file. This number uniquely identifies
|
||
|
the file device. This field will be 4,294,967,295 if the value could not fit in
|
||
|
the specified dev_t field. The complete value will be in the st_rdev64
|
||
|
field.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">dev64_t</td>
|
||
|
<td align="left" valign="top">st_rdev64</td>
|
||
|
<td align="left" valign="top">The device ID of the object in 64 bit format. See
|
||
|
st_rdev for more information.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">dev64_t</td>
|
||
|
<td align="left" valign="top">st_dev64</td>
|
||
|
<td align="left" valign="top">The file system ID to which the object belongs in
|
||
|
64 bit format. See st_dev for more information.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">nlink32_t</td>
|
||
|
<td align="left" valign="top">st_nlink32</td>
|
||
|
<td align="left" valign="top">The number of links to the file.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top"><img src="delta.gif" alt="Start of change">unsigned int</td>
|
||
|
<td align="left" valign="top">st_vfs</td>
|
||
|
<td align="left" valign="top">The unique mount ID of the file system on which
|
||
|
the object is located. Information about each mounted file system can be
|
||
|
obtained by using the QP0L_RETRIEVE_MOUNTED_FILE_SYSTEMS option of
|
||
|
<A href="qp0lflop.htm">QP0LFLOP()--Perform file system operation</A>.
|
||
|
<br> Unlike st_dev and st_dev64, st_vfs identifies a particular instance of a file system.
|
||
|
For any single file system, st_dev and st_dev64 will remain the
|
||
|
same across multiple mounts. In contrast, st_vfs is incremented whenever a file
|
||
|
system is mounted and is different for each mount of a file system.
|
||
|
Therefore, the value of st_vfs may change due to any system processing which
|
||
|
unmounts and mounts file systems, such as IPL and Reclaim Storage (RCLSTG).
|
||
|
<img src="deltaend.gif" alt="End of change">
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">char</td>
|
||
|
<td align="left" valign="top"><img src="delta.gif" alt="Start of change">st_reserved1[22]<img src="deltaend.gif" alt="End of change"></td>
|
||
|
<td align="left" valign="top">Reserved.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
|
||
|
<tr>
|
||
|
<td align="left" valign="top">unsigned short</td>
|
||
|
<td align="left" valign="top">st_ccsid</td>
|
||
|
<td align="left" valign="top">The CCSID used for the data in the file or the
|
||
|
extended attributes of the directory.<br>
|
||
|
<br>
|
||
|
</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
|
||
|
<p>Values of <samp>time_t</samp> are given in terms of seconds since a fixed
|
||
|
point in time called the <em>Epoch</em>.</p>
|
||
|
|
||
|
<p>You can examine properties of a <samp>mode_t</samp> value from the <samp>
|
||
|
st_mode</samp> field using a collection of macros defined in the <strong>
|
||
|
<sys/stat.h></strong> header file. If <em>mode</em> is a <samp>
|
||
|
mode_t</samp> value, then:</p>
|
||
|
|
||
|
<dl compact>
|
||
|
<dt><em>S_ISBLK(mode)</em></dt>
|
||
|
|
||
|
<dd>Is nonzero for block special files</dd>
|
||
|
|
||
|
<dt><em>S_ISCHR(mode)</em></dt>
|
||
|
|
||
|
<dd>Is nonzero for character special files</dd>
|
||
|
|
||
|
<dt><em>S_ISDIR(mode)</em></dt>
|
||
|
|
||
|
<dd>Is nonzero for directories</dd>
|
||
|
|
||
|
<dt><em>S_ISFIFO(mode)</em></dt>
|
||
|
|
||
|
<dd>Is nonzero for pipes and FIFO special files</dd>
|
||
|
|
||
|
<dt><em>S_ISREG(mode)</em></dt>
|
||
|
|
||
|
<dd>Is nonzero for regular files</dd>
|
||
|
|
||
|
<dt><em>S_ISLNK(mode)</em></dt>
|
||
|
|
||
|
<dd>Is nonzero for symbolic links</dd>
|
||
|
|
||
|
<dt><em>S_ISSOCK(mode)</em></dt>
|
||
|
|
||
|
<dd>Is nonzero for local sockets</dd>
|
||
|
|
||
|
<dt><em>S_ISNATIVE(mode)</em></dt>
|
||
|
|
||
|
<dd>Is nonzero for operating system native objects</dd>
|
||
|
</dl>
|
||
|
|
||
|
<br>
|
||
|
<h3><a name="USAGE_NOTES">Usage Notes</a></h3>
|
||
|
|
||
|
<ol type="1">
|
||
|
<li>When you develop in C-based languages, the prototypes for the 64-bit APIs
|
||
|
are normally hidden. To use either the <strong>stat64()</strong> API or the
|
||
|
<strong>QlgStat64()</strong> API and the <samp>struct stat64</samp> data type,
|
||
|
you must compile the source with <samp>_LARGE_FILE_API</samp> defined.<br>
|
||
|
</li>
|
||
|
|
||
|
<li>All of the usage notes for <strong>stat()</strong> also apply to <strong>
|
||
|
stat64()</strong> and to <strong>QlgStat64()</strong>. See <a href=
|
||
|
"stat.htm#HDRSTAUSAG">Usage Notes</a> in the <strong>stat()</strong> API.</li>
|
||
|
</ol>
|
||
|
|
||
|
<hr>
|
||
|
API introduced: V4R4
|
||
|
|
||
|
<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>
|
||
|
|