|
|
HP-UX Reference > Sstat(2)HP-UX 11i Version 2: December 2007 Update |
|
NAMEstat() — get file status DESCRIPTIONThe stat() function obtains information about the named file and writes it to the area pointed to by the buf argument. The path argument 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). Read, write or execute permission of the named file is not required, but all directories listed in the pathname leading to all directories listed in the pathname leading to the file must be searchable. An implementation that provides additional or alternate file access control mechanisms may, under implementation-dependent conditions, cause stat() to fail. In particular, the system may deny the existence of the file specified by path. The buf argument is a pointer to a stat structure, as defined in the header <sys/stat.h>, into which information is placed concerning the file. The stat structure contains the following members:
(Note that the position of items in this list does not necessarily reflect the order of the members in the structure.) 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() function updates any time-related fields (as described in the definition of File Times Update in the XBD specification), before writing into the stat structure. The structure members st_mode, st_ino, st_dev, st_uid, st_gid, st_atime, st_ctime, and st_mtime will have meaningful values for all file types defined in this document. The value of the member st_nlink will be set to the number of links to the file. RETURN VALUEUpon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. ERRORSThe stat() function will fail if:
The stat() function may fail if:
AUTHORstat() and fstat() were developed by AT&T. lstat() was developed by the University of California, Berkeley. |
|