lstat — get symbolic link status
const char *path,
struct stat *buf
The parameters for the
function are as follows:
is a pointer to a path name of any file within the mounted file
All directories listed in the path name must be searchable.
is a pointer to a
structure where the file status information is stored.
function has the same effect as
refers to a symbolic link. In that case
returns information about the link, while
returns information about the file the link references.
For symbolic links, the
member will contain meaningful information when used with the file type
macros, and the
member will contain the length of the pathname contained in the
symbolic link. File mode bits and the contents of the
remaining members of the
structure are unspecified. The value returned in the
member is the length of the contents of the symbolic
link, and does not count any trailing null.
If the chosen path name or file descriptor refers to a
Multi-Level Directory (MLD), and the process does not have the
multilevel effective privilege, the i-node number returned in
is the i-node of the MLD itself.
structure contains the following members:
|dev_t||st_dev;||/* ID of device containing a */|
|/* directory entry for this file */|
|ino_t||st_ino;||/* Inode number */|
|short||st_fstype;||/* Type of filesystem this file */|
|/* is in; see sysfs(2) */|
|ushort||st_mode;||/* File type, attributes, and */|
|/* access control summary */|
|ushort||st_basemode||/* Permission bits (see chmod(1)) */|
|ushort||st_nlink;||/* Number of links */|
|uid_t||st_uid;||/* User ID of file owner */|
|gid_t||st_gid;||/* Group ID of file group */|
|dev_t||st_rdev;||/* Device ID; this entry defined */|
|/* only for char or blk spec files */|
|off_t||st_size;||/* File size (bytes) */|
|time_t||st_atime;||/* Time of last access */|
|time_t||st_mtime;||/* Last modification time */|
|time_t||st_ctime;||/* Last file status change time */|
|/* Measured in secs since */|
|/* 00:00:00 GMT, Jan 1, 1970 */|
|long||st_blksize;||/* File system block size */|
|uint||st_acl:1;||/* Set if the file has optional */|
|/* access control list entries */|
|/* HFS File Systems only */|
|uint||st_aclv:1;||/* Set if the file has optional */|
|/* access control list entries */|
|/* JFS File Systems only */|
(Note that the position of items in this list does not necessarily
reflect the order of the members in the structure.)
Upon successful completion,
Otherwise, it returns
to indicate the error.
function will fail if:
A component of the path prefix denies search permission.
Too many symbolic links were encountered in resolving path.
The length of a pathname exceeds
or the pathname component is longer than
A component of the
prefix is not a directory.
A component of
does not name an existing file or
is an empty string.
A 32-bit application is making this call on a file where the
or other field(s) would need to hold a 64-bit value.
points to an invalid address.
The reliable detection of this error is
function may fail if:
The pathname resolution of a symbolic link produced an intermediate result
with a length exceeding
fields are zero on files accessed remotely. The
field is applicable to HFS File Systems only. The
field is applicable to JFS File Systems only.
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,
will be truncated to its least significant 32-bits for filesystems that use
fields are set to
if they are not specified on the disk for a given file.
were developed by AT&T.
was developed by the University of California, Berkeley.
lstat(): AES, SVID3
First released in Issue 4, Version 2.