STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) NAME NAME NAME NAME stat, fstat - get file status SYNOPSIS SYNOPSIS SYNOPSIS SYNOPSIS #include #include int stat (path, buf) char *path; struct stat *buf; int bstat (path, buf) char *path; struct bstat *buf; int fstat (fildes, buf) int fildes; struct stat *buf; int bfstat (fildes, buf) int fildes; struct bstat *buf; DESCRIPTION DESCRIPTION DESCRIPTION DESCRIPTION Path points to a path name naming a file. Read, write or execute permission of the named file is not required, but all directories listed in the path name leading to the file must be searchable. Stat obtains information about the named file. Similarly, fstat obtains information about an open file known by the file descriptor fildes , obtained from a successful open , creat , dup , fcntl , or pipe system call. Bstat and Bfstat are identical to stat and fstat except that the st_dev and st_rdev fields in the bstat structure are larger than the st_dev and st_rdev fields in the stat structure. Bstat and bfstat are used in place of stat and fstat on HP-UX implementations with long device numbers (e.g. the HP Integral PC). This difference is only relevant to applications which examine the st_dev or st_rdev fields of the stat (bstat) structure. Buf is a pointer to a stat structure into which information is placed concerning the file. The contents of the structure pointed to by buf include the following members: ushort st_mode; /* File mode; see mknod (2) */ ino_t st_ino; /* Inode number */ dev_t st_dev; /* ID of device containing */ /* a directory entry for this file Hewlett-Packard - 1 - (printed 12/12/84) STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) */ dev_t st_rdev; /* ID of device */ /* This entry is defined only for */ /* character special or block special files */ short st_nlink; /* Number of links */ ushort st_uid; /* User ID of the file's owner */ ushort st_gid; /* Group ID of the file's group */ off_t st_size; /* File size in bytes */ time_t st_atime; /* Time of last access */ time_t st_mtime; /* Time of last data modification */ time_t st_ctime; /* Time of last file status change */ /* Times measured in seconds since */ /* 00:00:00 GMT, Jan. 1, 1970 */ st_atime Time when file data was last accessed. Changed by the following system calls: creat (2), mknod (2), pipe (2), utime (2), and read (2). st_mtime Time when data was last modified. Changed by the following system calls: creat (2), mknod (2), pipe (2), utime (2), and write (2). st_ctime Time when file status was last changed. Changed by the following system calls: chmod (2), chown (2), creat (2), link (2), mknod (2), pipe (2), unlink (2), utime (2), and write (2). Stat will fail if one or more of the following are true: A component of the path prefix is not a directory. [ENOTDIR] The named file does not exist. [ENOENT] Search permission is denied for a component of the path prefix. [EACCES] Buf or path points to an invalid address. [EFAULT] Fstat will fail if one or more of the following are true: Fildes is not a valid open file descriptor. [EBADF] Buf points to an invalid address. [EFAULT] RETURN VALUE RETURN VALUE RETURN VALUE RETURN VALUE Upon successful completion a value of 0 is returned. Hewlett-Packard - 2 - (printed 12/12/84) STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) STAT(2) HP Integral PC STAT(2) Otherwise, a value of -1 is returned and errno is set to indicate the error. SEE ALSO SEE ALSO SEE ALSO SEE ALSO chmod(2), chown(2), creat(2), link(2), mknod(2), time(2), unlink(2). Hewlett-Packard - 3 - (printed 12/12/84)