/*
 * $Header: /smsa/bsd:include/sys/stat.h:bsd  1.10  $
 * $Source: /smsa/bsd:include/sys/stat.h: $
 *
 * Copyright (c) 1988 Acorn Computers Ltd., Cambridge, England
 *
 */
/* 
 * Copyright (c) 1982, 1986 Regents of the University of California.
 * All rights reserved.  The Berkeley software License Agreement
 * specifies the terms and conditions for redistribution.
 *
 *	@(#)stat.h	7.1 (Berkeley) 6/4/86
 */

#ifndef	__sys_stat_h
#define	__sys_stat_h

struct	stat
{
	dev_t	st_dev;
	ino_t	st_ino;
	mode_t	st_mode;
	nlink_t	st_nlink;
	uid_t	st_uid;
	gid_t	st_gid;
	dev_t	st_rdev;
	off_t	st_size;
	time_t	st_atime;
	int	st_spare1;
	time_t	st_mtime;
	int	st_spare2;
	time_t	st_ctime;
	int	st_spare3;
	long	st_blksize;
	long	st_blocks;
	long	st_spare4[2];
};

#define	S_IFMT	0170000		/* type of file */
#define		S_IFDIR	0040000	/* directory */
#define		S_IFCHR	0020000	/* character special */
#define		S_IFBLK	0060000	/* block special */
#define		S_IFREG	0100000	/* regular */
#define		S_IFLNK	0120000	/* symbolic link */
#define		S_IFSOCK 0140000/* socket */
#define		S_IFIFO 0010000 /* fifo */
#define	S_ISUID	0004000		/* set user id on execution */
#define	S_ISGID	0002000		/* set group id on execution */
#define	S_ISVTX	0001000		/* save swapped text even after use */
#define	S_IREAD	0000400		/* read permission, owner */
#define	S_IWRITE 0000200	/* write permission, owner */
#define	S_IEXEC	0000100		/* execute/search permission, owner */
#define S_IRWXU 000700		/* owner:  rwx------ */
#define		S_IRUSR	000400	/* owner:  r-------- */
#define		S_IWUSR	000200	/* owner:  -w------- */
#define		S_IXUSR	000100	/* owner:  --x------ */
#define S_IRWXG	000070		/* group:  ---rwx--- */
#define		S_IRGRP	000040	/* group:  ---r----- */
#define		S_IWGRP	000020	/* group:  ----w---- */
#define		S_IXGRP	000010	/* group:  -----x--- */
#define S_IRWXO	000007		/* others: ------rwx */
#define		S_IROTH	000004	/* others: ------r-- */ 
#define		S_IWOTH	000002	/* others: -------w- */
#define		S_IXOTH	000001	/* others: --------x */

#define S_ISBLK(s) (((s) & S_IFMT) == S_IFBLK)		/* is a block spec */
#define S_ISCHR(s) (((s) & S_IFMT) == S_IFCHR)		/* is a char spec */
#define S_ISDIR(s) (((s) & S_IFMT) == S_IFDIR)		/* is a directory */
#define S_ISFIFO(s) (((s) & S_IFMT) == S_IFIFO)		/* is a pipe/FIFO */
#define S_ISREG(s) (((s) & S_IFMT) == S_IFREG)		/* is a reg file */

#ifndef	_KERNEL
#if 0
extern int chmod (char * /*path*/, mode_t /*mode*/);
extern int fstat (int /*fildes*/, struct stat * /*buf*/);
extern int mkdir (char * /*path*/, mode_t /*mode*/);
extern int mkfifo (char * /*path*/, mode_t /*mode*/);
extern int stat (char * /*path*/, struct stat * /*buf*/);
extern int umask (mode_t /*cmask*/);
#else
extern int chmod ();
extern int fstat (int /*fildes*/, struct stat * /*buf*/);
extern int mkdir ();
extern int mkfifo ();
extern int stat (char * /*path*/, struct stat * /*buf*/);
extern int umask ();
#endif
#endif

#endif/*__sys_stat_h*/

/* EOF stat.h */
