.th stat IV 4/21/86
.sh NAME
stat - get file status
.sh SYNOPSIS
stat(name, buf)
.br
char *name;
.br
struct statbuf *buf;
.ft R
.sh DESCRIPTION
Name points to a null-terminated string naming a file; buf is the
address of a 36(10) byte 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 readable.  After stat, buf has the following structure (starting
offset given in bytes):
.s3
.if t .ta .5i 1i 2.5i
.if n .ta 3 9 24
.nf
struct statbuf {
	char	minor;	/* +0: minor device */
	char	major;	/* +1: major device */
	int	inumber;	/* +2 */
	int	flags;	/* +4: see below */
	char	nlinks;	/* +6: number of links to file */
	char	uid;	/* +7: user ID of owner */
	char	gid;	/* +8: group ID of owner */
	char	size0;	/* +9: high byte of 24-bit size */
	int	size1;	/* +10: low word of 24-bit size */
	int	addr[8];	/* +12: block numbers or device number */
	int	actime[2];	/* +28: time of last access */
	int	modtime[2];	/* +32: time of last modification */
};
.fi
.s3
The flags are as follows:
.s3
.lp +10 9
100000	allocated
.lp +10 9
060000	2-bit file type:
.lp +15 9
000000	plain file
.lp +15 9
040000	directory
.lp +15 9
020000	character-type special file
.lp +15 9
060000	block-type special file.
.lp +10 9
010000	large file
.lp +10 9
004000	set user-ID on execution
.lp +10 9
002000	set group-ID on execution
.lp +10 9
001000	save text image after execution
.lp +10 9
000400	read (owner)
.lp +10 9
000200	write (owner)
.lp +10 9
000100	execute (owner)
.i0
.sh "SEE ALSO"
fstat (IV), fs (V)
.sh DIAGNOSTICS
Error bit (c-bit) is set if the file cannot be found.  From C, a -1
return indicates an error.
.sh KSOS
Not all fields are meaningful under KSOS.  The stat call supplies
zeroes in such fields, which are: nlinks, addr, and, actime.
