lstat

OS/161 Reference Manual

Name

lstat - get file state information

Library

Standard C Library (libc, -lc)

Synopsis

#include <sys/stat.h>

int
lstat(const char *pathname, struct stat *statbuf);

Description

lstat retrieves status information about the file referred to by pathname and stores it in the stat structure pointed to by statbuf.

If pathname refers to a symbolic link, information about the link is retrieved rather than about the object the link points to.

Return Values

On success, lstat returns 0. On error, -1 is returned, and errno is set according to the error encountered.

Errors

The following error codes should be returned under the conditions given. Other error codes may be returned for other errors not mentioned here.
  
ENODEV The device prefix of filename did not exist.
ENOTDIR A non-final component of pathname was not a directory.
ENOENT The named file does not exist.
EIO A hard I/O error occurred.
EFAULT statbuf points to an invalid address.