DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

stat(FP)


stat -- data returned by stat system call

Syntax

#include <sys/stat.h>

Description

The sys/stat.h include file contains the definition for the structure returned by the stat and fstat functions. The structure is defined as:

   dev_t	st_dev;		/* ID of device containing  */
   			/* a directory entry for this file */
   ino32_t	st_ino;		/* i-node number (32 bits-worth)	*/
   mode_t 	st_mode;	/* File mode (permissions and type, see mknod(S)) */
   nlink_t	st_nlink;	/* Number of links			*/
   uid_t 	st_uid;		/* User ID of the file's owner		*/
   gid_t 	st_gid;		/* Group ID of the file's owner		*/
   dev_t	st_rdev;	/* ID of block/character special file	*/
   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 */
   long	st_blksize;	/* Preferred I/O block size in bytes	*/
   long	st_blocks;	/* Number st_blksize blocks allocated	*/
   char	st_fstype[_ST_FSTYPSZ];	/* A string containing filesystem's type */

The st_mode value is actually a combination of one or more of the following file mode values:

   S_IFMT     0170000        /* type of file */
   S_IFREG    0100000        /* regular */
   S_IFBLK    0060000        /* block special */
   S_IFDIR    0040000        /* directory */
   S_IFCHR    0020000        /* character special */
   S_IFIFO    0010000        /* fifo */
   S_IFNAM    0050000        /* special named file */
   S_IFLNK    0120000        /* symbolic link */
The following definitions provide POSIX compliance of file permissions:
   S_IREAD    00400          /* read permission, owner */
   S_IWRITE   00200          /* write permission, owner */
   S_IEXEC    00100          /* execute/search permission, owner */
   

S_ISUID 04000 /* set user id on execution */ S_ISGID 02000 /* set group id on execution */

S_ISVTX 01000 /* save swapped text even after use */

S_IRWXU 00700 /* read, write, execute: owner */ S_IRUSR 00400 /* read permission: owner */ S_IWUSR 00200 /* write permission: owner */ S_IXUSR 00100 /* execute permission: owner */

S_IRWXG 00070 /* read, write, execute: group */ S_IRGRP 00040 /* read permission: group */ S_IWGRP 00020 /* write permission: group */ S_IXGRP 00010 /* execute permission: group */

S_IRWXO 00007 /* read, write, execute: other */ S_IROTH 00004 /* read permission: other */ S_IWOTH 00002 /* write permission: other */ S_IXOTH 00001 /* execute permission: other */

Files

/usr/include/sys/stat.h

See also

stat(S)

Standards conformance

stat is conformant with:

X/Open CAE Specification, System Interfaces and Headers, Issue 4, Version 2;
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1) ;
and NIST FIPS 151-1 .


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003