NAME
ESTAT - estat(), lestat(), festat(): Gets status of a file.
SYNOPSIS
#include <nx.h>
long estat(
char *path,
struct estat *buffer );
long lestat(
char *path,
struct estat *buffer );
long festat(
int fildes,
struct estat *buffer );
PARAMETERS
path Pointer to the pathname identifying a file.
buffer Pointer to an estat structure in which the status
information is placed. The estat structure is
described in the sys/estat.h header file.
The estat structure has the following form:
struct estat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
dev_t st_rdev;
esize_t st_size;
time_t st_atime;
int st_spare1;
time_t st_mtime;
int st_spare2;
time_t st_ctime;
int st_spare3;
ulong_t st_blksize;
long st_blocks;
ulong_t st_flags;
ulong_t st_gen;
};
fildes File descriptor for an extended file or standard
OSF/1 file open for writing. A standard OSF/1 file
cannot be greater than 2G - 1 bytes.
DESCRIPTION
You can use the estat(), lestat(), and festat() functions to
access regular files and extended files, while the stat(),
lstat(), and fstat() functions do not support extended
files. Extended files can have a size a greater than 2G - 1
bytes, while regular files cannot.
The estat(), lestat(), and festat() function semantics are
identical to the OSF/1 stat(), lstat(), and fstat() func-
tions, respectively. See the stat(2) manual page in the
OSF/1 Programmer's Reference.
The estat() function gets information about the file named
by the path parameter. Read, write, or execute permission
for the named file is not required, but all directories
listed in the pathname leading to the file must be search-
able. The file information is written to the area specified
by the buffer parameter, which is a pointer to an estat
structure, defined in the sys/estat.h header file.
The lestat() function is like the estat() function, except
when the named file is a symbolic link. In this case, the
lestat() function returns information about the link. The
estat() and festat() functions return information about the
file the link references. For symbolic links, the lestat()
function sets the st_size field of the estat structure to
the length of the symbolic link, and sets the st_mode field
to indicate the file type.
The festat() function is identical to the estat() function
except it returns information about an open file specified
by the fildes parameter.
RETURN VALUES
Upon successful completion, the estat(), lestat(), and fes-
tat() functions return a value of 0 (zero). Otherwise, these
functions display an error message to standard error and
cause the calling process to terminate.
Upon successful completion, the _estat(), _lestat(), and
_festat() functions return a value of 0 (zero). Otherwise,
these functions return -1 and set errno to indicate the
error.
ERRORS
If the _estat(), _lestat(), or _festat() functions fail,
errno may be set to one of the error code values described
for the OSF/1 stat() function.
EXAMPLES
The following example shows how to use the festat() and
estat() functions to access statistics about files:
#include <fcntl.h>
#include <nx.h>
void display();
main()
{
int fd;
struct estat result;
fd = gopen(``/tmp/mydata'', O_RDWR, M_UNIX, 0644);
festat(fd,&result);
printf(``st_atime = %ld\n'',result.st_atime);
display(``st_size = ``,result.st_size);
estat(``/tmp/mydata'',&result);
printf(``st_atime = %ld\n'',result.st_atime);
display(``st_size = ``,result.st_size);
close(fd);
}
void display(ss,eout)
char *ss;
esize_t eout;
{
char s[20];
etos(eout,s);
printf(``%s%s\n'',ss,s);
}
LIMITATIONS AND WORKAROUNDS
For information about limitations and workarounds, see the
release notes files in /usr/share/release_notes.
SEE ALSO
eseek(), esize()
OSF/1 Programmer's Reference: dup(2), open(2), stat(2)
Acknowledgement and Disclaimer