STATX(2,L) AIX Technical Reference STATX(2,L)
-------------------------------------------------------------------------------
statx, fstatx, stat, fstat, fullstat, ffullstat, lstat
PURPOSE
Provides information about a file.
SYNTAX
#include <stat.h>
int statx(path, buf, len, cmd)
char *path;
struct stat *buf;
int len;
int cmd;
int fstatx(fildes, buf, len, cmd)
int fildes;
struct stat *buf;
int len;
int cmd;
DESCRIPTION
The statx and fstatx system calls obtain information about a file. The path
parameter to statx is a path name identifying the file. The fildes parameter
is a file descriptor obtained from a successful open, fcntl, pipe, socket or
socketpair system call.
Information is returned in the stat structure pointed to by the buf parameter
(see "stat.h"). The len parameter indicates the amount of information to be
returned.
The cmd parameter determines how to interpret the path name provided;
specifically, whether to retrieve information about a symbolic link, hidden
directory or mount point.
STX_LINK If cmd specifies STX_LINK and path is a path name which refers to a
symbolic link, statx returns information about the symbolic link.
Otherwise, statx returns information about the file to which the link
refers.
If cmd specifies STX_LINK and path refers to a symbolic link, the
st_mode and st_type fields of the returned stat structure indicates
the file is a symbolic link.
STX_HIDDEN
If cmd specifies STX_HIDDEN and path is a path name which refers to a
hidden directory, statx returns information about the hidden
Processed November 7, 1990 STATX(2,L) 1
STATX(2,L) AIX Technical Reference STATX(2,L)
directory. Otherwise, statx returns information about the selected
component of the hidden directory.
If cmd specifies STX_HIDDEN and path refers to a hidden directory,
the st_mode and st_type fields of the returned stat structure
indicate this is a hidden directory.
STX_MOUNT If cmd specifies STX_MOUNT and path names the root of a mounted file
system, statx returns information about the mounted-over directory.
Otherwise, statx returns information about the root of the mounted
file system.
If cmd specifies STX_MOUNT, the FS_MOUNT bit in the st_flag field of
the returned stat structure is set if (and only if) this file is
mounted over.
If cmd does not specify STX_MOUNT, the FS_MOUNT bit in the st_flag
field of the returned stat structure is set if (and only if) this
file is the root of a file system.
COMPATIBILITY INTERFACES
The following interfaces are provided for compatibility with programs written
for AIX/RT or other versions of the UNIX operating system.
stat(path, stbuf)
is equivalent to:
statx(path, stbuf, STATSIZE, 0)
lstat(path, stbuf)
is equivalent to:
statx(path, stbuf, STATSIZE, STX_LINK)
fstat(fd, stbuf)
is equivalent to:
fstatx(fd, stbuf, STATSIZE, 0)
#include <sys/fullstat.h>
fullstat(path, cmd, buf)
is equivalent to:
statx(path, buf, FULLSTATSIZE, cmd)
#include <sys/fullstat.h>
Processed November 7, 1990 STATX(2,L) 2
STATX(2,L) AIX Technical Reference STATX(2,L)
ffullstat(fd, cmd, buf)
is equivalent to:
fstatx(fd, buf, FULLSTATSIZE, cmd)
RETURN VALUE
Upon successful completion, both the statx and fstatx system calls return a
value of 0. If the statx or fstatx system calls fail, a value of -1 is
returned, and errno is set to indicate the error.
ERROR CONDITIONS
The statx and fstatx system calls fail if one or more of the following are
true:
ENOTDIR A component of the path prefix is not a directory.
ENOENT A component of the path prefix does not exist, or the process has the
System V lookup attribute and a component is exactly 14 characters
long (see "ulimit").
EACCES Search permission is denied on a component of the path prefix.
ENOENT The path name is null.
ESTALE The process's root or current directory is located in a virtual file
system that has been unmounted.
EFAULT The path parameter points to a location outside of the process's
allocated address space.
ELOOP A loop of symbolic links was detected.
ENAMETOOLONG
A component of the path parameter exceeded NAME_MAX characters or the
entire path parameter exceeded PATH_MAX characters.
ENOENT A hidden directory was named, but no component inside it matched the
process's current site path list.
ENOENT A symbolic link was named, but the file to which it refers does not
exist.
EIO An I/O error occurred during the operation.
ENOENT The file named by path does not exist.
EBADF The fildes parameter is not a valid file descriptor.
Processed November 7, 1990 STATX(2,L) 3
STATX(2,L) AIX Technical Reference STATX(2,L)
If the Transparent Computing Facility is installed on your system, the statx
and fstatx system calls can also fail if one or more of the following are true:
ESITEDN1 The path cannot be accessed because a site went down.
ESITEDN2 The operation was terminated because a site failed.
ENOSTORE The path is a name relative to the working directory, but no site
which stores this directory is currently up.
ENOSTORE A component of path is replicated but is not stored on any site which
is currently up.
ESITEDN1 The site or sites on which the file is stored are now down or the
file descriptor is open for writing and the site where the file is
stored has gone down since the file was opened.
ENFILE The system inode table on another cluster site is out of space.
EINTR A signal was caught during the statx system call.
RELATED INFORMATION
In this book: "chmod, fchmod," "chown, fchown," "link," "mknod, mknodx,
mkfifo," "pipe," "read, readv, readx," "times," "unlink, rmslink, remove,"
"ustat," "utime," "write, writex," "master," and "stat.h."
Also see "The Base AIX File Systems" discussion in Chapter 1 of Managing the
AIX Operating System.
Processed November 7, 1990 STATX(2,L) 4