man(1) Manual page archive


     STAT(2)                                                   STAT(2)

     NAME
          stat, fstat - get file status

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

          stat(name, buf)
          char *name;
          struct stat *buf;

          fstat(fildes, buf)
          struct stat *buf;

     DESCRIPTION
          Stat obtains detailed information about a named file.  Fstat
          obtains the same information about an open file known by the
          file descriptor from a successful open, creat, dup or
          pipe(2) call.

          Name points to a null-terminated string naming a file; buf
          is the address of a buffer into which information is placed
          concerning the file.  It is unnecessary to have any permis-
          sions at all with respect to the file, but all directories
          leading to the file must be searchable.  The layout of the
          structure pointed to by buf as defined in <stat.h> is given
          below.  St_mode is encoded according to the `#define' state-
          ments.