10 #include <sys/types.h>
18 /* dj's stat defines _STAT_H_ */
21 /* It is intended that the layout of this structure not change when the
22 sizes of any of the basic types change (short, int, long) [via a compile
35 /* SysV/sco doesn't have the rest... But Solaris, eabi does. */
36 #if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
53 #define _IFMT 0170000 /* type of file */
54 #define _IFDIR 0040000 /* directory */
55 #define _IFCHR 0020000 /* character special */
56 #define _IFBLK 0060000 /* block special */
57 #define _IFREG 0100000 /* regular */
58 #define _IFLNK 0120000 /* symbolic link */
59 #define _IFSOCK 0140000 /* socket */
60 #define _IFIFO 0010000 /* fifo */
62 #define S_BLKSIZE 1024 /* size of a block */
64 #define S_ISUID 0004000 /* set user id on execution */
65 #define S_ISGID 0002000 /* set group id on execution */
67 #define S_ISVTX 0001000 /* save swapped text even after use */
68 #define S_IREAD 0000400 /* read permission, owner */
69 #define S_IWRITE 0000200 /* write permission, owner */
70 #define S_IEXEC 0000100 /* execute/search permission, owner */
71 #define S_ENFMT 0002000 /* enforcement-mode locking */
74 #define S_IFDIR _IFDIR
75 #define S_IFCHR _IFCHR
76 #define S_IFBLK _IFBLK
77 #define S_IFREG _IFREG
78 #define S_IFLNK _IFLNK
79 #define S_IFSOCK _IFSOCK
80 #define S_IFIFO _IFIFO
81 #endif /* !_POSIX_SOURCE */
84 /* The Windows header files define _S_ forms of these, so we do too
85 for easier portability. */
87 #define _S_IFDIR _IFDIR
88 #define _S_IFCHR _IFCHR
89 #define _S_IFIFO _IFIFO
90 #define _S_IFREG _IFREG
91 #define _S_IREAD 0000400
92 #define _S_IWRITE 0000200
93 #define _S_IEXEC 0000100
96 #define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
97 #define S_IRUSR 0000400 /* read permission, owner */
98 #define S_IWUSR 0000200 /* write permission, owner */
99 #define S_IXUSR 0000100/* execute/search permission, owner */
100 #define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
101 #define S_IRGRP 0000040 /* read permission, group */
102 #define S_IWGRP 0000020 /* write permission, grougroup */
103 #define S_IXGRP 0000010/* execute/search permission, group */
104 #define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
105 #define S_IROTH 0000004 /* read permission, other */
106 #define S_IWOTH 0000002 /* write permission, other */
107 #define S_IXOTH 0000001/* execute/search permission, other */
109 #define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
110 #define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
111 #define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
112 #define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
113 #define S_ISREG(m) (((m)&_IFMT) == _IFREG)
114 #define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
115 #define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
118 int _EXFUN(chmod
,( const char *__path
, mode_t __mode
));
119 int _EXFUN(fchmod
,(int __fd
, mode_t __mode
));
120 int _EXFUN(fstat
,( int __fd
, struct stat
*__sbuf
));
121 int _EXFUN(mkdir
,( const char *_path
, mode_t __mode
));
122 int _EXFUN(mkfifo
,( const char *__path
, mode_t __mode
));
123 int _EXFUN(stat
,( const char *__path
, struct stat
*__sbuf
));
124 mode_t
_EXFUN(umask
,( mode_t __mask
));
126 #if defined(__rtems__) || defined(__CYGWIN__) || defined(__MSYS__)
127 int _EXFUN(lstat
,( const char *__path
, struct stat
*__buf
));
128 int _EXFUN(mknod
,( const char *__path
, mode_t __mode
, dev_t __dev
));
131 /* Provide prototypes for most of the _<systemcall> names that are
132 provided in newlib for some compilers. */
133 int _EXFUN(_fstat
,( int __fd
, struct stat
*__sbuf
));
134 int _EXFUN(_stat
,( const char *__path
, struct stat
*__sbuf
));
136 #endif /* !_STAT_H_ */
140 #endif /* _SYS_STAT_H */