xref: /titanic_44/usr/src/lib/libbc/inc/include/sys/stat.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
23*5d54f3d8Smuffin  * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
24*5d54f3d8Smuffin  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate #ifndef	__SYS_STAT_H
287c478bd9Sstevel@tonic-gate #define	__SYS_STAT_H
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
317c478bd9Sstevel@tonic-gate 
32*5d54f3d8Smuffin /*
33*5d54f3d8Smuffin  * NOTE: changes to this file should also be made to xpg2include/sys/stat.h
34*5d54f3d8Smuffin  */
35*5d54f3d8Smuffin 
367c478bd9Sstevel@tonic-gate #include <sys/types.h>
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
397c478bd9Sstevel@tonic-gate extern "C" {
407c478bd9Sstevel@tonic-gate #endif
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate struct	stat {
437c478bd9Sstevel@tonic-gate 	dev_t	st_dev;
447c478bd9Sstevel@tonic-gate 	ino_t	st_ino;
457c478bd9Sstevel@tonic-gate 	mode_t	st_mode;
467c478bd9Sstevel@tonic-gate 	short	st_nlink;
477c478bd9Sstevel@tonic-gate 	uid_t	st_uid;
487c478bd9Sstevel@tonic-gate 	gid_t	st_gid;
497c478bd9Sstevel@tonic-gate 	dev_t	st_rdev;
507c478bd9Sstevel@tonic-gate 	off_t	st_size;
517c478bd9Sstevel@tonic-gate 	time_t	st_atime;
527c478bd9Sstevel@tonic-gate 	int	st_spare1;
537c478bd9Sstevel@tonic-gate 	time_t	st_mtime;
547c478bd9Sstevel@tonic-gate 	int	st_spare2;
557c478bd9Sstevel@tonic-gate 	time_t	st_ctime;
567c478bd9Sstevel@tonic-gate 	int	st_spare3;
577c478bd9Sstevel@tonic-gate 	long	st_blksize;
587c478bd9Sstevel@tonic-gate 	long	st_blocks;
597c478bd9Sstevel@tonic-gate 	long	st_spare4[2];
607c478bd9Sstevel@tonic-gate };
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate #define	_IFMT		0170000	/* type of file */
637c478bd9Sstevel@tonic-gate #define		_IFDIR	0040000	/* directory */
647c478bd9Sstevel@tonic-gate #define		_IFCHR	0020000	/* character special */
657c478bd9Sstevel@tonic-gate #define		_IFBLK	0060000	/* block special */
667c478bd9Sstevel@tonic-gate #define		_IFREG	0100000	/* regular */
677c478bd9Sstevel@tonic-gate #define		_IFLNK	0120000	/* symbolic link */
687c478bd9Sstevel@tonic-gate #define		_IFSOCK	0140000	/* socket */
697c478bd9Sstevel@tonic-gate #define		_IFIFO	0010000	/* fifo */
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate #define	S_ISUID		0004000	/* set user id on execution */
727c478bd9Sstevel@tonic-gate #define	S_ISGID		0002000	/* set group id on execution */
737c478bd9Sstevel@tonic-gate #ifndef	_POSIX_SOURCE
747c478bd9Sstevel@tonic-gate #define	S_ISVTX		0001000	/* save swapped text even after use */
757c478bd9Sstevel@tonic-gate #define	S_IREAD		0000400	/* read permission, owner */
767c478bd9Sstevel@tonic-gate #define	S_IWRITE 	0000200	/* write permission, owner */
777c478bd9Sstevel@tonic-gate #define	S_IEXEC		0000100	/* execute/search permission, owner */
787c478bd9Sstevel@tonic-gate 
797c478bd9Sstevel@tonic-gate #define	S_ENFMT 	0002000	/* enforcement-mode locking */
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate #define	S_IFMT		_IFMT
827c478bd9Sstevel@tonic-gate #define	S_IFDIR		_IFDIR
837c478bd9Sstevel@tonic-gate #define	S_IFCHR		_IFCHR
847c478bd9Sstevel@tonic-gate #define	S_IFBLK		_IFBLK
857c478bd9Sstevel@tonic-gate #define	S_IFREG		_IFREG
867c478bd9Sstevel@tonic-gate #define	S_IFLNK		_IFLNK
877c478bd9Sstevel@tonic-gate #define	S_IFSOCK	_IFSOCK
887c478bd9Sstevel@tonic-gate #define	S_IFIFO		_IFIFO
897c478bd9Sstevel@tonic-gate #endif	/* !_POSIX_SOURCE */
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate #define	S_IRWXU 	0000700	/* rwx, owner */
927c478bd9Sstevel@tonic-gate #define		S_IRUSR	0000400	/* read permission, owner */
937c478bd9Sstevel@tonic-gate #define		S_IWUSR	0000200	/* write permission, owner */
947c478bd9Sstevel@tonic-gate #define		S_IXUSR	0000100	/* execute/search permission, owner */
957c478bd9Sstevel@tonic-gate #define	S_IRWXG		0000070	/* rwx, group */
967c478bd9Sstevel@tonic-gate #define		S_IRGRP	0000040	/* read permission, group */
977c478bd9Sstevel@tonic-gate #define		S_IWGRP	0000020	/* write permission, grougroup */
987c478bd9Sstevel@tonic-gate #define		S_IXGRP	0000010	/* execute/search permission, group */
997c478bd9Sstevel@tonic-gate #define	S_IRWXO		0000007	/* rwx, other */
1007c478bd9Sstevel@tonic-gate #define		S_IROTH	0000004	/* read permission, other */
1017c478bd9Sstevel@tonic-gate #define		S_IWOTH	0000002	/* write permission, other */
1027c478bd9Sstevel@tonic-gate #define		S_IXOTH	0000001	/* execute/search permission, other */
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate #define	S_ISBLK(m)	(((m)&_IFMT) == _IFBLK)
1057c478bd9Sstevel@tonic-gate #define	S_ISCHR(m)	(((m)&_IFMT) == _IFCHR)
1067c478bd9Sstevel@tonic-gate #define	S_ISDIR(m)	(((m)&_IFMT) == _IFDIR)
1077c478bd9Sstevel@tonic-gate #define	S_ISFIFO(m)	(((m)&_IFMT) == _IFIFO)
1087c478bd9Sstevel@tonic-gate #define	S_ISREG(m)	(((m)&_IFMT) == _IFREG)
1097c478bd9Sstevel@tonic-gate #ifndef	_POSIX_SOURCE
1107c478bd9Sstevel@tonic-gate #define	S_ISLNK(m)	(((m)&_IFMT) == _IFLNK)
1117c478bd9Sstevel@tonic-gate #define	S_ISSOCK(m)	(((m)&_IFMT) == _IFSOCK)
1127c478bd9Sstevel@tonic-gate #endif
1137c478bd9Sstevel@tonic-gate 
114*5d54f3d8Smuffin int	chmod(char *, mode_t);
115*5d54f3d8Smuffin int	fstat(int, struct stat *);
116*5d54f3d8Smuffin int	mkdir(char *, mode_t);
117*5d54f3d8Smuffin int	mkfifo(char *, mode_t);
118*5d54f3d8Smuffin int	stat(char *, struct stat *);
119*5d54f3d8Smuffin mode_t	umask(mode_t);
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1227c478bd9Sstevel@tonic-gate }
1237c478bd9Sstevel@tonic-gate #endif
1247c478bd9Sstevel@tonic-gate 
1257c478bd9Sstevel@tonic-gate #endif	/* __SYS_STAT_H */
126