stat.2 (2010 09)

s
stat(2) stat(2)
be set to the number of links to the file.
Note: The st_natime , st_nmtime , and st_nctime fields are currently reserved. To avoid compatibility
problems, these fields should not be used.
RETURN VALUE
Upon successful completion, 0 is returned. Otherwise, 1 is returned and
errno is set to indicate the
error.
ERRORS
The
stat() function will fail if:
[EACCES] Search permission is denied for a component of the path prefix.
[EFAULT] buf or path points to an invalid address. The reliable detection of this error
is implementation dependent.
[EIO] An error occurred while reading from the file system.
[ELOOP] Too many symbolic links were encountered in resolving path.
[ENAMETOOLONG] The length of the path argument exceeds
{PATH_MAX}
or a pathname com-
ponent is longer than
{NAME_MAX}.
[ENOENT] A component of path does not name an existing file or path is an empty
string.
[ENOTDIR] A component of the path prefix is not a directory.
[EOVERFLOW] The file size in bytes or the number of blocks allocated to the file cannot be
represented correctly in the structure pointed to by buf .
The
stat() function may fail if:
[ENAMETOOLONG] Pathname resolution of a symbolic link produced an intermediate result
whose length exceeds
{PATH_MAX}.
[EOVERFLOW] A 32-bit application is making this call on a file where the
st_size or other
field(s) would need to hold a 64-bit value. Use stat64() instead.
NETWORKING FEATURES
NFS
The st_basemode is equal to st_mode and st_acl and the st_aclv fields are zero on files accessed remotely.
The st_acl field is applicable to HFS File Systems only. The st_aclv field is applicable to JFS File Sys-
tems only.
WARNINGS
Access Control Lists - HFS and JFS File Systems only
Access control list descriptions in this entry apply only to HFS and JFS file systems on standard HP-UX
operating systems.
For 32-bit applications, st_ino will be truncated to its least significant 32-bits for filesystems that use
64-bit values.
DEPENDENCIES
CD-ROM
The st_uid and st_gid fields are set to 1 if they are not specified on the disk for a given file.
AUTHOR
stat() and fstat() were developed by AT&T. lstat() was developed by the University of Califor-
nia, Berkeley.
SEE ALSO
touch(1), acl(2), chmod(2), chown(2), creat(2), fstat(2), link(2), lstat(2), mknod(2), pipe(2), read(2),
rename(2), setacl(2), stat64(2), sysfs(2), time(2), truncate(2), unlink(2), utime(2), write(2), acl(5), aclv(5),
privileges(5), stat(5), <sys/stat.h>, <sys/types.h>.
STANDARDS CONFORMANCE
stat(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
2 Hewlett-Packard Company 2 HP-UX 11i Version 3: September 2010