10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 23*722Smuffin * Copyright 2001 Sun Microsystems, Inc. All rights reserved. 24*722Smuffin * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef __SYS_STAT_H 280Sstevel@tonic-gate #define __SYS_STAT_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 32*722Smuffin /* 33*722Smuffin * NOTE: changes to this file should also be made to xpg2include/sys/stat.h 34*722Smuffin */ 35*722Smuffin 360Sstevel@tonic-gate #include <sys/types.h> 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifdef __cplusplus 390Sstevel@tonic-gate extern "C" { 400Sstevel@tonic-gate #endif 410Sstevel@tonic-gate 420Sstevel@tonic-gate struct stat { 430Sstevel@tonic-gate dev_t st_dev; 440Sstevel@tonic-gate ino_t st_ino; 450Sstevel@tonic-gate mode_t st_mode; 460Sstevel@tonic-gate short st_nlink; 470Sstevel@tonic-gate uid_t st_uid; 480Sstevel@tonic-gate gid_t st_gid; 490Sstevel@tonic-gate dev_t st_rdev; 500Sstevel@tonic-gate off_t st_size; 510Sstevel@tonic-gate time_t st_atime; 520Sstevel@tonic-gate int st_spare1; 530Sstevel@tonic-gate time_t st_mtime; 540Sstevel@tonic-gate int st_spare2; 550Sstevel@tonic-gate time_t st_ctime; 560Sstevel@tonic-gate int st_spare3; 570Sstevel@tonic-gate long st_blksize; 580Sstevel@tonic-gate long st_blocks; 590Sstevel@tonic-gate long st_spare4[2]; 600Sstevel@tonic-gate }; 610Sstevel@tonic-gate 620Sstevel@tonic-gate #define _IFMT 0170000 /* type of file */ 630Sstevel@tonic-gate #define _IFDIR 0040000 /* directory */ 640Sstevel@tonic-gate #define _IFCHR 0020000 /* character special */ 650Sstevel@tonic-gate #define _IFBLK 0060000 /* block special */ 660Sstevel@tonic-gate #define _IFREG 0100000 /* regular */ 670Sstevel@tonic-gate #define _IFLNK 0120000 /* symbolic link */ 680Sstevel@tonic-gate #define _IFSOCK 0140000 /* socket */ 690Sstevel@tonic-gate #define _IFIFO 0010000 /* fifo */ 700Sstevel@tonic-gate 710Sstevel@tonic-gate #define S_ISUID 0004000 /* set user id on execution */ 720Sstevel@tonic-gate #define S_ISGID 0002000 /* set group id on execution */ 730Sstevel@tonic-gate #ifndef _POSIX_SOURCE 740Sstevel@tonic-gate #define S_ISVTX 0001000 /* save swapped text even after use */ 750Sstevel@tonic-gate #define S_IREAD 0000400 /* read permission, owner */ 760Sstevel@tonic-gate #define S_IWRITE 0000200 /* write permission, owner */ 770Sstevel@tonic-gate #define S_IEXEC 0000100 /* execute/search permission, owner */ 780Sstevel@tonic-gate 790Sstevel@tonic-gate #define S_ENFMT 0002000 /* enforcement-mode locking */ 800Sstevel@tonic-gate 810Sstevel@tonic-gate #define S_IFMT _IFMT 820Sstevel@tonic-gate #define S_IFDIR _IFDIR 830Sstevel@tonic-gate #define S_IFCHR _IFCHR 840Sstevel@tonic-gate #define S_IFBLK _IFBLK 850Sstevel@tonic-gate #define S_IFREG _IFREG 860Sstevel@tonic-gate #define S_IFLNK _IFLNK 870Sstevel@tonic-gate #define S_IFSOCK _IFSOCK 880Sstevel@tonic-gate #define S_IFIFO _IFIFO 890Sstevel@tonic-gate #endif /* !_POSIX_SOURCE */ 900Sstevel@tonic-gate 910Sstevel@tonic-gate #define S_IRWXU 0000700 /* rwx, owner */ 920Sstevel@tonic-gate #define S_IRUSR 0000400 /* read permission, owner */ 930Sstevel@tonic-gate #define S_IWUSR 0000200 /* write permission, owner */ 940Sstevel@tonic-gate #define S_IXUSR 0000100 /* execute/search permission, owner */ 950Sstevel@tonic-gate #define S_IRWXG 0000070 /* rwx, group */ 960Sstevel@tonic-gate #define S_IRGRP 0000040 /* read permission, group */ 970Sstevel@tonic-gate #define S_IWGRP 0000020 /* write permission, grougroup */ 980Sstevel@tonic-gate #define S_IXGRP 0000010 /* execute/search permission, group */ 990Sstevel@tonic-gate #define S_IRWXO 0000007 /* rwx, other */ 1000Sstevel@tonic-gate #define S_IROTH 0000004 /* read permission, other */ 1010Sstevel@tonic-gate #define S_IWOTH 0000002 /* write permission, other */ 1020Sstevel@tonic-gate #define S_IXOTH 0000001 /* execute/search permission, other */ 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate #define S_ISBLK(m) (((m)&_IFMT) == _IFBLK) 1050Sstevel@tonic-gate #define S_ISCHR(m) (((m)&_IFMT) == _IFCHR) 1060Sstevel@tonic-gate #define S_ISDIR(m) (((m)&_IFMT) == _IFDIR) 1070Sstevel@tonic-gate #define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO) 1080Sstevel@tonic-gate #define S_ISREG(m) (((m)&_IFMT) == _IFREG) 1090Sstevel@tonic-gate #ifndef _POSIX_SOURCE 1100Sstevel@tonic-gate #define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) 1110Sstevel@tonic-gate #define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) 1120Sstevel@tonic-gate #endif 1130Sstevel@tonic-gate 114*722Smuffin int chmod(char *, mode_t); 115*722Smuffin int fstat(int, struct stat *); 116*722Smuffin int mkdir(char *, mode_t); 117*722Smuffin int mkfifo(char *, mode_t); 118*722Smuffin int stat(char *, struct stat *); 119*722Smuffin mode_t umask(mode_t); 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate #ifdef __cplusplus 1220Sstevel@tonic-gate } 1230Sstevel@tonic-gate #endif 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate #endif /* __SYS_STAT_H */ 126