Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chmod(2)

chown(2)

creat(2)

dg_mstat(2)

fchmod(2)

fchown(2)

fstat(2)

link(2)

lstat(2)

mknod(2)

pipe(2)

read(2)

time(2)

unlink(2)

utime(2)

utimes(2)

write(2)



stat(2)                           SDK R4.11                          stat(2)


NAME
       stat - get file status

SYNOPSIS
       #include <sys/types.h>
       #include <sys/stat.h>

       int  stat (path, buffer_ptr)
       const char * path;
       struct stat * buffer_ptr;

   where:
       path           Address of a pathname

       buffer_ptr     Address of a stat buffer to fill

DESCRIPTION
       Stat returns the current attributes of the file named by the pathname
       pointed to by path into the stat buffer at the location specified by
       buffer_ptr.  If path refers to a symbolic link, file status for the
       target of the symbolic link is returned.  To display the file status
       of the symbolic link itself, use lstat(2).

       The subject file must be of type `ordinary-disk-file', `directory',
       `block-special-file', `character-special-file', or `fifo-special-
       file'.

       The information returned in the stat structure includes:

       dev_t           st_dev         The major and minor device numbers
                                      representing the flat file store
                                      containing the file.
       ino_t           st_ino         The inode number of the file.
       mode_t          st_mode        The file mode (see below).
       nlink_t         st_nlink       The number of links to the file.
       uid_t           st_uid         The user ID of the file.
       gid_t           st_gid         The group ID of the file.
       dev_t           st_rdev        The major and minor device numbers
                                      representing a special file. It is
                                      only applicable when the device is
                                      either a `block-special-file' or
                                      `character-special-file.'
       off_t           st_size        The size of the file in bytes.
       time_t          st_atime       The time of the last access of the
                                      file
       time_t          st_mtime       The time of the last data modification
                                      of the file.
       time_t          st_ctime       The time of the last attribute change
                                      of the file.
       long            st_blksize     The data element size of the file.
       long            st_blocks      The number of blocks allocated to the
                                      file.
       char            st_fstype[16]  The file system type string.

       When DG/UX source features are in use and _SIMPLE_STAT_TIMES_FLAVOR
       is not defined, the stat structure also includes the following:

       unsigned long   st_ausec       The extended-precision portion of
                                      st_atime, in microseconds.
       unsigned long   st_musec       The extended-precision portion of
                                      st_mtime, in microseconds.
       unsigned long   st_cusec       The extended-precision portion of
                                      st_ctime, in microseconds.
       timestruc_t     st_atim        The time in seconds and nanoseconds of
                                      the last access of the file.
       timestruc_t     st_mtim        The time in seconds and nanoseconds of
                                      the last modification of the file.
       timestruc_t     st_ctim        The time in seconds and nanoseconds of
                                      the last attribute change of the file.

       If stat fails, the contents of the returned structure are undefined.

       The st_mode field is encoded using the following literals:

       S_IFMT       type of file
       S_IFDIR      directory
       S_IFCHR      character special
       S_IFBLK      block special
       S_IFREG      regular
       S_IFLNK      symbolic link
       S_IFIFO      fifo
       S_IFSOCK     socket special file
       S_ISUID      set user id on execution
       S_ISGID      set group id on execution
       S_ISVTX      save swapped text even after use
       S_IREAD      read permission, owner
       S_IWRITE     write permission, owner
       S_IEXEC      execute/search permission, owner
       S_ENFMT      record locking enforcement flag
       S_IRWXU      read, write, execute search permission, owner
       S_IRUSR      read permission, owner
       S_IWUSR      write permission, owner
       S_IXUSR      execute/search permission, owner
       S_IRWXG      read, write, execute/search group
       S_IRGRP      read permission, group
       S_IWGRP      write permission, group
       S_IXGRP      execute/search permission, group
       S_IRWXO      read, write, execute/search, other
       S_IROTH      read permission, other
       S_IWOTH      write permission, other
       S_IXOTH      execute/search permission, other

Intel Platform
       When DG/UX or SVR4 source features are in use and
       _SIMPLE_STAT_TIMES_FLAVOR is not defined, the st_atime, st_mtime, and
       st_ctime "members" of the stat structure are actually macros.  Under
       these conditions, use of these three names except to access the
       "members" of the stat structure will not work.

       When DG/UX source features are in use and _SIMPLE_STAT_TIMES_FLAVOR
       is not defined, the st_ausec, st_musec, and st_cusec "members" of the
       stat structure are actually macros. Under these conditions, use of
       these three names except to access the "members" of the stat
       structure will not work.

ACCESS CONTROL
       Read, write, or execute permission of the named file is not required,
       but the process must have permission to resolve path.

RETURN VALUE
       0      The stat operation was successful.

       -1     An error occurred.  errno is set to indicate the error.

DIAGNOSTICS
       Errno may be set to one of the following error codes:

       EFAULT         Buffer_ptr points to an invalid address.

       ENOENT         The file the pathname resolved to does not exist.

       ENOENT         A non-terminal component of the pathname does not
                      exist.

       ENOTDIR        A non-terminal component of the pathname was not a
                      directory or symbolic link.

       ENAMETOOLONG   The pathname exceeds the length limit for pathnames.

       ENAMETOOLONG   A component of the pathname exceeds the length limit
                      for filenames.

       ENOMEM         There are not enough system resources to resolve the
                      pathname or to expand a symbolic link.

       ELOOP          The number of symbolic links encountered during
                      pathname resolution exceeded MAXSYMLINKS.  A symbolic
                      link cycle is suspected.

       EPERM          The pathname contains a character not in the allowed
                      character set.

       EFAULT         The pathname does not completely reside in the
                      process's address space or the pathname does not
                      terminate in the process's address space.

SEE ALSO
       chmod(2), chown(2), creat(2), dg_mstat(2), fchmod(2), fchown(2),
       fstat(2), link(2), lstat(2), mknod(2), pipe(2), read(2), time(2),
       unlink(2), utime(2), utimes(2), write(2).


Licensed material--property of copyright holder(s)

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