Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (k - m) lstat(2)
NAME
lstat - Provides information about a symbolic link or any le
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <sys/stat.h>
int lstat(
const char *path,
struct stat *buffer);
PARAMETERS
path Points to the pathname of a le. If used for a symbolic link, then the path param-
eter points to the pathname of the symbolic link identifying the le.
buffer Points to a stat structure, into which information is placed about the le.
DESCRIPTION
The lstat() function obtains information about the symbolic link whose name is pointed to by the
path parameter or about any le pointed to by the path parameter.
The lstat() function is like the stat() or fstat() function, except that lstat( ) returns information
about the link, while the stat() and fstat() functions return information about the le that the link
refers to.
Read, write, or execute permission for the named le is not required, but all directories listed in
the pathname leading to the le must be searchable.
The le information is written to the area specied by the buffer parameter, which is a pointer to
a stat structure with the following denition from the sys/stat.h header le:
struct stat {
dev_t st_dev;
ino_t st_ino;
mode_t st_mode;
nlink_t st_nlink;
char filler_1[2];
uid_t st_uid;
gid_t st_gid;
char filler_2[4];
dev_t st_rdev;
off_t st_size;
time_t st_atime;
time_t st_mtime;
time_t st_ctime;
int64_t reserved[3];
};
For symbolic links to local OSS objects, the st_mode and st_size elds are valid and the other
elds in the structure are undened. For symbolic links that resolve to les in /E, the st_dev,
st_ino, st_atime, st_mtime, and st_ctime elds are dened as described in this reference page.
For les other than a symbolic link, the lstat() function sets the st_size eld of the stat structure
to the length in characters of the absolute pathname resulting from the resolution of the name
527186-003 Hewlett-Packard Company 413