The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

lstat - get symbolic link status

 SYNOPSIS



#include <sys/stat.h>

int lstat(const char *path, struct stat *buf);

 DESCRIPTION

The lstat() function has the same effect as stat(), except when path refers to a symbolic link. In that case lstat() returns information about the link, while stat() returns information about the file the link references.

For symbolic links, the st_mode member will contain meaningful information when used with the file type macros, and the st_size 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 stat structure are unspecified. The value returned in the st_size member is the length of the contents of the symbolic link, and does not count any trailing null.

 RETURN VALUE

Upon successful completion, lstat() returns 0. Otherwise, it returns -1 and sets errno to indicate the error.

 ERRORS

The lstat() function will fail if:
[EACCES]
A component of the path prefix denies search permission.
[EIO]
An error occurred while reading from the file system.
[ELOOP]
Too many symbolic links were encountered in resolving path.
[ENAMETOOLONG]
The length of a pathname exceeds {PATH_MAX}, or pathname component is longer than {NAME_MAX}.
[ENOTDIR]
A component of the path prefix is not a directory.
[ENOENT]
A component of path does not name an existing file or path is an empty string.
[EOVERFLOW]
The file size in bytes or the number of blocks allocated to the file or the file serial number cannot be represented correctly in the structure pointed to by buf.

The lstat() function may fail if:

[ENAMETOOLONG]
Pathname resolution of a symbolic link produced an intermediate result whose length exceeds {PATH_MAX}.
[EOVERFLOW]
One of the members is too large to store into the structure pointed to by the buf argument.

 EXAMPLES

None.

 APPLICATION USAGE

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

fstat(), readlink(), stat(), symlink(), <sys/stat.h>.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]