STAT(2) — UNIX Programmer’s Manual
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 permissions 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’ statements.
/∗
static char stat_h_SCCS_ID[] = "@(#)stat.h4.1 10/26/82";
/∗
/∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗