*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> lstat (2)              


 lstat(2)                                                           lstat(2)

 NAME    [Toc]    [Back]
      lstat - get symbolic link status

 SYNOPSIS    [Toc]    [Back]
      #include <sys/stat.h>

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

 PARAMETERS    [Toc]    [Back]
      The parameters for the lstat() function are as follows:

           path      is a pointer to a path name of any file within the
                     mounted file system.  All directories listed in the
                     path name must be searchable.

           buf       is a pointer to a stat structure where the file status
                     information is stored.

 DESCRIPTION    [Toc]    [Back]
      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.  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 st_ino is the i-node of the MLD itself.

      The stat 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 */

 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003

 lstat(2)                                                           lstat(2)

           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.)

 RETURN VALUE    [Toc]    [Back]
      Upon successful completion, lstat() returns 0.  Otherwise, it returns
      -1 and sets errno to indicate the error.

 ERRORS    [Toc]    [Back]
      The lstat() function will fail if:

           [EACCES]             A component of the path prefix denies search

           [ELOOP]              Too many symbolic links were encountered in
                                resolving path.

           [ENAMETOOLONG]       The length of a pathname exceeds {PATH_MAX},
                                or the pathname component is longer than

           [ENOTDIR]            A component of the path prefix is not a

           [ENOENT]             A component of path does not name an
                                existing file or path is an empty string.

           [EOVERFLOW]          A 32-bit application is making this call on
                                a file where the st_size or other field(s)
                                would need to hold a 64-bit value.

           [EFAULT]             buf points to an invalid address.  The
                                reliable detection of this error is
                                implementation dependent.

 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003

 lstat(2)                                                           lstat(2)

      The lstat() function may fail if:

           [ENAMETOOLONG]       The pathname resolution of a symbolic link
                                produced an intermediate result with a
                                length exceeding {PATH_MAX}.

      The st_basemode, st_acl and st_aclv fields are zero on files accessed
      remotely.  The st_acl field is applicable to HFS File Systems only.
      The st_aclv field is applicable to JFS File Systems only.

 WARNINGS    [Toc]    [Back]
    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, st_ino will be truncated to its least
      significant 32-bits for filesystems that use 64-bit values.

 DEPENDENCIES (CD-ROM)    [Toc]    [Back]
      The st_uid and st_gid fields are set to -1 if they are not specified
      on the disk for a given file.

 AUTHOR    [Toc]    [Back]
      stat() and fstat() were developed by AT&T.  lstat() was developed by
      the University of California, Berkeley.

 SEE ALSO    [Toc]    [Back]
      touch(1), acl(2), chmod(2), chown(2), creat(2), fstat(2), link(2),
      lstat64(2), mknod(2), pipe(2), read(2), readlink(2), rename(2),
      setacl(2), stat(2), symlink(2), sysfs(2), time(2), truncate(2),
      unlink(2), utime(2), write(2), acl(5), aclv(5), stat(5), <sys/stat.h>.

      lstat(): AES, SVID3

 CHANGE HISTORY    [Toc]    [Back]
      First released in Issue 4, Version 2.

 Hewlett-Packard Company            - 3 -   HP-UX 11i Version 2: August 2003
[ Back ]
 Similar pages
Name OS Title
ln Tru64 Make a hard link or a symbolic link to a file
symlink HP-UX symbolic link
readlink Linux read value of a symbolic link
readlink IRIX read the value of a symbolic link
readlink NetBSD read value of a symbolic link
readlink OpenBSD read value of a symbolic link
readlink FreeBSD read value of a symbolic link
symlink OpenBSD symbolic link handling
readlink Tru64 Read the value of a symbolic link
symlink FreeBSD symbolic link handling
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service