V8/usr/man/man2/stat.2

Compare this file to the similar file:
Show the results in this format:

.TH STAT 2 
.SH NAME
stat, lstat, fstat \- get file status
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.B #include <sys/stat.h>
.PP
.B stat(name, buf)
.B char *name;
.B struct stat *buf;
.PP
.B lstat(name, buf)
.B char *name;
.B struct stat *buf;
.PP
.B fstat(fildes, buf)
.B struct stat *buf;
.fi
.SH DESCRIPTION
.I Stat
obtains detailed information about a named file.
.I Lstat
obtains the same information, but in the case of a symbolic
link (see
.IR link (2)),
supplies information about the link itself.
.I Fstat
obtains the same information about an open file
known by a file descriptor.
.PP
.I Name
points to a null-terminated string naming
a file;
.I 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
is given below;
.I st_mode 
is encoded according to the `#define' statements.
.PP
.nf
.ta 5m 10m 15m 20m 25m 30m 35m 40m 45m 50m 55m 60m
.so /usr/include/sys/stat.h
.fi
.DT
.PP
The mode bits 0000070 and 0000007 encode group and
others permissions (see
.IR chmod (2)).
The defined types,
.I 
ino_t, off_t, time_t,
name various width integer values;
.I dev_t
encodes
major and minor device numbers;
their exact definitions are in
the include file <sys/types.h>
(see
.IR types (5)).
.PP
.I St_atime
is the time the file was last read.
For reasons of efficiency, it is not set when a directory
is searched, although this would be more logical.
.I St_mtime
is the time the file was last written or created.
It is not set by changes of owner, group, link count, or mode.
.I St_ctime
is set both by writing and and by changing the i-node.
.SH "SEE ALSO"
ls(1), chmod(2), filsys(5)
.SH DIAGNOSTICS
Zero is returned if a status is available;
\-1 if the file cannot be found.