1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright (c) 2001 by Sun Microsystems, Inc.
24*0Sstevel@tonic-gate  * All rights reserved.
25*0Sstevel@tonic-gate  */
26*0Sstevel@tonic-gate 
27*0Sstevel@tonic-gate /*
28*0Sstevel@tonic-gate  * NOTE: changes to this file should also be made to xpg2include/sys/stat.h
29*0Sstevel@tonic-gate  */
30*0Sstevel@tonic-gate 
31*0Sstevel@tonic-gate #ifndef	__SYS_STAT_H
32*0Sstevel@tonic-gate #define	__SYS_STAT_H
33*0Sstevel@tonic-gate 
34*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
35*0Sstevel@tonic-gate 
36*0Sstevel@tonic-gate #include <sys/types.h>
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #ifdef	__cplusplus
39*0Sstevel@tonic-gate extern "C" {
40*0Sstevel@tonic-gate #endif
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate struct	stat {
43*0Sstevel@tonic-gate 	dev_t	st_dev;
44*0Sstevel@tonic-gate 	ino_t	st_ino;
45*0Sstevel@tonic-gate 	mode_t	st_mode;
46*0Sstevel@tonic-gate 	short	st_nlink;
47*0Sstevel@tonic-gate 	uid_t	st_uid;
48*0Sstevel@tonic-gate 	gid_t	st_gid;
49*0Sstevel@tonic-gate 	dev_t	st_rdev;
50*0Sstevel@tonic-gate 	off_t	st_size;
51*0Sstevel@tonic-gate 	time_t	st_atime;
52*0Sstevel@tonic-gate 	int	st_spare1;
53*0Sstevel@tonic-gate 	time_t	st_mtime;
54*0Sstevel@tonic-gate 	int	st_spare2;
55*0Sstevel@tonic-gate 	time_t	st_ctime;
56*0Sstevel@tonic-gate 	int	st_spare3;
57*0Sstevel@tonic-gate 	long	st_blksize;
58*0Sstevel@tonic-gate 	long	st_blocks;
59*0Sstevel@tonic-gate 	long	st_spare4[2];
60*0Sstevel@tonic-gate };
61*0Sstevel@tonic-gate 
62*0Sstevel@tonic-gate #define	_IFMT		0170000	/* type of file */
63*0Sstevel@tonic-gate #define		_IFDIR	0040000	/* directory */
64*0Sstevel@tonic-gate #define		_IFCHR	0020000	/* character special */
65*0Sstevel@tonic-gate #define		_IFBLK	0060000	/* block special */
66*0Sstevel@tonic-gate #define		_IFREG	0100000	/* regular */
67*0Sstevel@tonic-gate #define		_IFLNK	0120000	/* symbolic link */
68*0Sstevel@tonic-gate #define		_IFSOCK	0140000	/* socket */
69*0Sstevel@tonic-gate #define		_IFIFO	0010000	/* fifo */
70*0Sstevel@tonic-gate 
71*0Sstevel@tonic-gate #define	S_ISUID		0004000	/* set user id on execution */
72*0Sstevel@tonic-gate #define	S_ISGID		0002000	/* set group id on execution */
73*0Sstevel@tonic-gate #ifndef	_POSIX_SOURCE
74*0Sstevel@tonic-gate #define	S_ISVTX		0001000	/* save swapped text even after use */
75*0Sstevel@tonic-gate #define	S_IREAD		0000400	/* read permission, owner */
76*0Sstevel@tonic-gate #define	S_IWRITE 	0000200	/* write permission, owner */
77*0Sstevel@tonic-gate #define	S_IEXEC		0000100	/* execute/search permission, owner */
78*0Sstevel@tonic-gate 
79*0Sstevel@tonic-gate #define	S_ENFMT 	0002000	/* enforcement-mode locking */
80*0Sstevel@tonic-gate 
81*0Sstevel@tonic-gate #define	S_IFMT		_IFMT
82*0Sstevel@tonic-gate #define	S_IFDIR		_IFDIR
83*0Sstevel@tonic-gate #define	S_IFCHR		_IFCHR
84*0Sstevel@tonic-gate #define	S_IFBLK		_IFBLK
85*0Sstevel@tonic-gate #define	S_IFREG		_IFREG
86*0Sstevel@tonic-gate #define	S_IFLNK		_IFLNK
87*0Sstevel@tonic-gate #define	S_IFSOCK	_IFSOCK
88*0Sstevel@tonic-gate #define	S_IFIFO		_IFIFO
89*0Sstevel@tonic-gate #endif	/* !_POSIX_SOURCE */
90*0Sstevel@tonic-gate 
91*0Sstevel@tonic-gate #define	S_IRWXU 	0000700	/* rwx, owner */
92*0Sstevel@tonic-gate #define		S_IRUSR	0000400	/* read permission, owner */
93*0Sstevel@tonic-gate #define		S_IWUSR	0000200	/* write permission, owner */
94*0Sstevel@tonic-gate #define		S_IXUSR	0000100	/* execute/search permission, owner */
95*0Sstevel@tonic-gate #define	S_IRWXG		0000070	/* rwx, group */
96*0Sstevel@tonic-gate #define		S_IRGRP	0000040	/* read permission, group */
97*0Sstevel@tonic-gate #define		S_IWGRP	0000020	/* write permission, grougroup */
98*0Sstevel@tonic-gate #define		S_IXGRP	0000010	/* execute/search permission, group */
99*0Sstevel@tonic-gate #define	S_IRWXO		0000007	/* rwx, other */
100*0Sstevel@tonic-gate #define		S_IROTH	0000004	/* read permission, other */
101*0Sstevel@tonic-gate #define		S_IWOTH	0000002	/* write permission, other */
102*0Sstevel@tonic-gate #define		S_IXOTH	0000001	/* execute/search permission, other */
103*0Sstevel@tonic-gate 
104*0Sstevel@tonic-gate #define	S_ISBLK(m)	(((m)&_IFMT) == _IFBLK)
105*0Sstevel@tonic-gate #define	S_ISCHR(m)	(((m)&_IFMT) == _IFCHR)
106*0Sstevel@tonic-gate #define	S_ISDIR(m)	(((m)&_IFMT) == _IFDIR)
107*0Sstevel@tonic-gate #define	S_ISFIFO(m)	(((m)&_IFMT) == _IFIFO)
108*0Sstevel@tonic-gate #define	S_ISREG(m)	(((m)&_IFMT) == _IFREG)
109*0Sstevel@tonic-gate #ifndef	_POSIX_SOURCE
110*0Sstevel@tonic-gate #define	S_ISLNK(m)	(((m)&_IFMT) == _IFLNK)
111*0Sstevel@tonic-gate #define	S_ISSOCK(m)	(((m)&_IFMT) == _IFSOCK)
112*0Sstevel@tonic-gate #endif
113*0Sstevel@tonic-gate 
114*0Sstevel@tonic-gate #ifndef	KERNEL
115*0Sstevel@tonic-gate int	chmod(/* char *path, mode_t mode */);
116*0Sstevel@tonic-gate int	fstat(/* int fd; struct stat *sbuf */);
117*0Sstevel@tonic-gate int	mkdir(/* char *path; mode_t mode */);
118*0Sstevel@tonic-gate int	mkfifo(/* char *path; mode_t mode */);
119*0Sstevel@tonic-gate int	stat(/* char *path; struct stat *sbuf */);
120*0Sstevel@tonic-gate mode_t	umask(/* mode_t mask */);
121*0Sstevel@tonic-gate #endif
122*0Sstevel@tonic-gate 
123*0Sstevel@tonic-gate #ifdef	__cplusplus
124*0Sstevel@tonic-gate }
125*0Sstevel@tonic-gate #endif
126*0Sstevel@tonic-gate 
127*0Sstevel@tonic-gate #endif	/* __SYS_STAT_H */
128