stat [ MPE/iX Developer's Kit Reference Manual Volume I ] MPE/iX 5.0 Documentation
MPE/iX Developer's Kit Reference Manual Volume I
stat
Returns file status information.
Syntax
#include <sys/types.h>
#include <sys/stat.h>
int stat (const char *pathname, struct stat *buffer);
Parameters
pathname A pointer to a string containing a pathname of the file or
directory from which to obtain information. The pathname must
be terminated by a null character.
buffer A pointer to a buffer of type struct stat (defined in
<sys/stat.h>) where file status information is returned.
Return Values
0 Success.
-1 An error occurred. File status information is not returned
and errno is set to indicate the error condition.
Description
The stat() function returns status information on the specified file or
directory to the structure pointed to by buffer.
The stat() function updates to the current time all time fields that have
been previously marked for update. All update marks are removed.
Implementation Considerations
Refer to the EACCES, EFAULT, EIMPL, and ESYSERR error descriptions below.
Access permissions to the file are not required, but if the file or
directory has an MPE/iX ACD, the calling process must have MPE/iX read
ACD (RACD) access to the file or directory, or an error occurs.
Errors
If an error occurs, errno is set to one of the following values:
EACCES CAUSE The calling process does not have search permission
to a component of the pathname.
ACTION Make sure that the calling process has search
permission to all components of the pathname.
EFAULT CAUSE The system detected a NULL or bad address in
attempting to use the buffer or pathname parameters,
or the pathname was not terminated by a null
character.
ACTION Make sure that the pointer is correctly initialized.
ENAMETOOLONG CAUSE One of the following:
* The length of the pathname exceeds the
{PATH_MAX} limit (defined in the file
<limits.h>).
* A component of the pathname is longer than
{NAME_MAX} (defined in <limits.h>), and
{_POSIX_NO_TRUNC} is in effect for that
directory.
ACTION Make sure that both the component's length and the
full pathname length do not exceed the {NAME_MAX} or
{PATH_MAX} limits.
ENOENT CAUSE The specified file does not exist, or pathname points
to an empty string.
ACTION Specify a valid pathname.
ENOTDIR CAUSE A component of the pathname is not a directory.
ACTION Specify a valid pathname.
Table 4-0. (cont.)
EPERM CAUSE The calling process does not have MPE/iX read ACD
(RACD) access to the file, or the pathname begins
with two slash characters (//).
ACTION Make sure that the calling process has RACD access to
the file before calling stat(), or do not begin the
pathname with two slash characters (//).
ESYSERR CAUSE Access denied. Unable to map UID and GID to owner of
the file or directory either because user database is
corrupted or because the MPE/iX file type is not
supported by POSIX/iX library functions.
ACTION Check to see if the user database is corrupted, or if
the MPE/iX file type is supported by POSIX/iX library
functions.
See Also
creat(), dup(), fstat(), open(), <sys/stat.h>, POSIX.1 (Section 5.6.2)
MPE/iX 5.0 Documentation