Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

stat(2)

types(0)



  stat(0)                             CLIX                             stat(0)



  NAME

    stat - Data returned by the stat() function

  SYNOPSIS

    #include <types.h>

    #include <stat.h>

  DESCRIPTION

    The stat() and fstat() functions return data for which the structure is
    defined by the <stat.h> include file.  The encoding of the st_mode field
    is also defined in this file.

    The structure of the result of stat() is described as follows:

    dev_t st_dev
           The ID for the file system containing the named file.  This value
           may be used as input to the ustat() function to determine more
           information about this file system.  No other meaning is associated
           with this value.

    ushort st_ino
           The inode number of the named file.  The pair st_ino and st_dev
           uniquely identifies regular files.

    ushort st_mode
           The mode of the named file, as described in the mknod() function.

    short st_nlink
           The number of links to the named file.  This member should be used
           only by administrative commands.

    ushort st_uid
           The user ID of the named file's owner.

    ushort st_gid
           The group ID of the named file's group.

    dev_t st_rdev
           The device ID.  This entry is defined only for character special or
           block special files and only has meaning on the system where the
           file was configured.  This member should be used only by
           administrative commands.

    off_t st_size
           For regular files, this member specifies the address of the end of
           the file.  For pipes or fifos, this member specifies the count of
           the data currently in the file.  For block or character special



  2/94 - Intergraph Corporation                                              1






  stat(0)                             CLIX                             stat(0)



           files, this member is not defined.

    time_t st_atime
           The time of last access to the named file.  This member is changed
           by the following functions:  creat(), mknod(), pipe(), utime(), and
           read().

    time_t st_mtime
           The time of last data modification to the named file.  This member
           is changed by the following functions:  creat(), mknod(), pipe(),
           utime(), and read().

    time_t st_ctime
           The time of last file status change to the named file.  This member
           is changed by the following functions:  chmod(), chown(), creat(),
           link(), mkdir(), mknod(), pipe(), rename(), rmdir(), unlink(),
           utime(), and write().

    The following statements are file mode flags (st_mode), whose values are
    logically OR'ed together:

    #define S_IFMT       0170000
           The type of file is one of the following.

    #define S_IFDIR      0040000
           The named file is a directory file.

    #define S_IFCHR      0020000
           The named file is a character special file.

    #define S_IFBLK      0060000
           The named file is a block special file.

    #define S_IFREG      0100000
           The named file is an ordinary file.

    #define S_IFIFO      0010000
           The named file is a fifo special file.

    #define S_IFSOCK     0070000
           The named filed is a socket.

    #define S_ISUID      04000
           The named file has set-user-ID on execution.

    #define S_ISGID      02000
           The named file has set-group-ID on execution.

    #define S_ISVTX      01000
           The named file has saved swapped text even after use.




  2                                              Intergraph Corporation - 2/94






  stat(0)                             CLIX                             stat(0)



    #define S_IREAD      00400
           The named file has read permissions for the owner.

    #define S_IWRITE     00200
           The named file has write permissions for the owner.

    #define S_IEXEC      00100
           The named file has execute/search permissions for the owner.

    #define S_ENFMT      S_ISGID
           The named file has record locking enforcement flag.

    #define S_IRWXU      00700
           The named file has read, write, and execute permissions for the
           owner.

    #define S_IRUSR      00400
           The named file has read permissions for the owner.

    #define S_IWUSR      00200
           The named file has write permissions for the owner.

    #define S_IXUSR      00100
           The named file has execute permissions for the owner.

    #define S_IRWXG      00070
           The named file has read, write, and execute permissions for its
           group.

    #define S_IRGRP      00040
           The named file has read permissions for its group.

    #define S_IWGRP      00020
           The named file has write permissions for its group.

    #define S_IXGRP      00010
           The named file has execute permissions for its group.

    #define S_IRWXO      00007
           The named file has read, write, and execute permissions for other
           users.

    #define S_IROTH      00004
           The named file has read permissions for other users.

    #define S_IWOTH      00002
           The named file has write permissions for other users.

    #define S_IXOTH      00001
           The named file has execute permissions for other users.




  2/94 - Intergraph Corporation                                              3






  stat(0)                             CLIX                             stat(0)



    The following statements are test macros.  (Note that mm is an st_mode
    value.)

    #define S_ISDIR(mm)  (((mm&S_IFMT) == S_IFDIR) ? 1 : 0)
           This macro returns a 1 if the named file is a directory file.

    #define S_ISCHR(mm)  (((mm&S_IFMT) == S_IFCHR) ? 1 : 0)
           This macro returns a 1 if the named file is a character special
           file.

    #define S_ISBLK(mm)  (((mm&S_IFMT) == S_IFBLK) ? 1 : 0)
           This macro returns a 1 if the named file is a block special file.

    #define S_ISREG(mm)  (((mm&S_IFMT) == S_IFREG) ? 1 : 0)
           This macro returns a 1 if the named file is a regular file.

    #define S_ISFIFO(mm) (((mm&S_IFMT) == S_IFIFO) ? 1 : 0)
           This macro returns a 1 if the named file is a pipe or fifo special
           file.

    #define S_ISLNK(mm)  (((mm&S_IFMT) == S_IFLNK) ? 1 : 0)
           This macro returns a 1 if the named file is a symbolic link.

  RELATED INFORMATION

    Functions: stat(2)

    Files: types(0)


























  4                                              Intergraph Corporation - 2/94




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026