1 |
148 |
jeremybenn |
#ifndef _SYS_STAT_H
|
2 |
|
|
#define _SYS_STAT_H
|
3 |
|
|
|
4 |
|
|
#ifdef __cplusplus
|
5 |
|
|
extern "C" {
|
6 |
|
|
#endif
|
7 |
|
|
|
8 |
|
|
#include <_ansi.h>
|
9 |
|
|
#include <time.h>
|
10 |
|
|
#include <sys/types.h>
|
11 |
|
|
|
12 |
|
|
/* dj's stat defines _STAT_H_ */
|
13 |
|
|
#ifndef _STAT_H_
|
14 |
|
|
|
15 |
|
|
/* It is intended that the layout of this structure not change when the
|
16 |
|
|
sizes of any of the basic types change (short, int, long) [via a compile
|
17 |
|
|
time option]. */
|
18 |
|
|
|
19 |
|
|
#ifdef __CYGWIN__
|
20 |
|
|
#include <cygwin/stat.h>
|
21 |
|
|
#ifdef _COMPILING_NEWLIB
|
22 |
|
|
#define stat64 __stat64
|
23 |
|
|
#endif
|
24 |
|
|
#else
|
25 |
|
|
struct stat
|
26 |
|
|
{
|
27 |
|
|
dev_t st_dev;
|
28 |
|
|
ino_t st_ino;
|
29 |
|
|
mode_t st_mode;
|
30 |
|
|
nlink_t st_nlink;
|
31 |
|
|
uid_t st_uid;
|
32 |
|
|
gid_t st_gid;
|
33 |
|
|
dev_t st_rdev;
|
34 |
|
|
off_t st_size;
|
35 |
|
|
/* SysV/sco doesn't have the rest... But Solaris, eabi does. */
|
36 |
|
|
#if defined(__svr4__) && !defined(__PPC__) && !defined(__sun__)
|
37 |
|
|
time_t st_atime;
|
38 |
|
|
time_t st_mtime;
|
39 |
|
|
time_t st_ctime;
|
40 |
|
|
#else
|
41 |
|
|
time_t st_atime;
|
42 |
|
|
long st_spare1;
|
43 |
|
|
time_t st_mtime;
|
44 |
|
|
long st_spare2;
|
45 |
|
|
time_t st_ctime;
|
46 |
|
|
long st_spare3;
|
47 |
|
|
long st_blksize;
|
48 |
|
|
long st_blocks;
|
49 |
|
|
long st_spare4[2];
|
50 |
|
|
#endif
|
51 |
|
|
};
|
52 |
|
|
#endif
|
53 |
|
|
|
54 |
|
|
#define _IFMT 0170000 /* type of file */
|
55 |
|
|
#define _IFDIR 0040000 /* directory */
|
56 |
|
|
#define _IFCHR 0020000 /* character special */
|
57 |
|
|
#define _IFBLK 0060000 /* block special */
|
58 |
|
|
#define _IFREG 0100000 /* regular */
|
59 |
|
|
#define _IFLNK 0120000 /* symbolic link */
|
60 |
|
|
#define _IFSOCK 0140000 /* socket */
|
61 |
|
|
#define _IFIFO 0010000 /* fifo */
|
62 |
|
|
|
63 |
|
|
#define S_BLKSIZE 1024 /* size of a block */
|
64 |
|
|
|
65 |
|
|
#define S_ISUID 0004000 /* set user id on execution */
|
66 |
|
|
#define S_ISGID 0002000 /* set group id on execution */
|
67 |
|
|
#ifndef _POSIX_SOURCE
|
68 |
|
|
#define S_ISVTX 0001000 /* save swapped text even after use */
|
69 |
|
|
#define S_IREAD 0000400 /* read permission, owner */
|
70 |
|
|
#define S_IWRITE 0000200 /* write permission, owner */
|
71 |
|
|
#define S_IEXEC 0000100 /* execute/search permission, owner */
|
72 |
|
|
#define S_ENFMT 0002000 /* enforcement-mode locking */
|
73 |
|
|
|
74 |
|
|
#define S_IFMT _IFMT
|
75 |
|
|
#define S_IFDIR _IFDIR
|
76 |
|
|
#define S_IFCHR _IFCHR
|
77 |
|
|
#define S_IFBLK _IFBLK
|
78 |
|
|
#define S_IFREG _IFREG
|
79 |
|
|
#define S_IFLNK _IFLNK
|
80 |
|
|
#define S_IFSOCK _IFSOCK
|
81 |
|
|
#define S_IFIFO _IFIFO
|
82 |
|
|
#endif /* !_POSIX_SOURCE */
|
83 |
|
|
|
84 |
|
|
#ifdef _WIN32
|
85 |
|
|
/* The Windows header files define _S_ forms of these, so we do too
|
86 |
|
|
for easier portability. */
|
87 |
|
|
#define _S_IFMT _IFMT
|
88 |
|
|
#define _S_IFDIR _IFDIR
|
89 |
|
|
#define _S_IFCHR _IFCHR
|
90 |
|
|
#define _S_IFIFO _IFIFO
|
91 |
|
|
#define _S_IFREG _IFREG
|
92 |
|
|
#define _S_IREAD 0000400
|
93 |
|
|
#define _S_IWRITE 0000200
|
94 |
|
|
#define _S_IEXEC 0000100
|
95 |
|
|
#endif
|
96 |
|
|
|
97 |
|
|
#define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR)
|
98 |
|
|
#define S_IRUSR 0000400 /* read permission, owner */
|
99 |
|
|
#define S_IWUSR 0000200 /* write permission, owner */
|
100 |
|
|
#define S_IXUSR 0000100/* execute/search permission, owner */
|
101 |
|
|
#define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP)
|
102 |
|
|
#define S_IRGRP 0000040 /* read permission, group */
|
103 |
|
|
#define S_IWGRP 0000020 /* write permission, grougroup */
|
104 |
|
|
#define S_IXGRP 0000010/* execute/search permission, group */
|
105 |
|
|
#define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH)
|
106 |
|
|
#define S_IROTH 0000004 /* read permission, other */
|
107 |
|
|
#define S_IWOTH 0000002 /* write permission, other */
|
108 |
|
|
#define S_IXOTH 0000001/* execute/search permission, other */
|
109 |
|
|
|
110 |
|
|
#define S_ISBLK(m) (((m)&_IFMT) == _IFBLK)
|
111 |
|
|
#define S_ISCHR(m) (((m)&_IFMT) == _IFCHR)
|
112 |
|
|
#define S_ISDIR(m) (((m)&_IFMT) == _IFDIR)
|
113 |
|
|
#define S_ISFIFO(m) (((m)&_IFMT) == _IFIFO)
|
114 |
|
|
#define S_ISREG(m) (((m)&_IFMT) == _IFREG)
|
115 |
|
|
#define S_ISLNK(m) (((m)&_IFMT) == _IFLNK)
|
116 |
|
|
#define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK)
|
117 |
|
|
|
118 |
|
|
#if defined(__CYGWIN__)
|
119 |
|
|
/* Special tv_nsec values for futimens(2) and utimensat(2). */
|
120 |
|
|
#define UTIME_NOW -2L
|
121 |
|
|
#define UTIME_OMIT -1L
|
122 |
|
|
#endif
|
123 |
|
|
|
124 |
|
|
int _EXFUN(chmod,( const char *__path, mode_t __mode ));
|
125 |
|
|
int _EXFUN(fchmod,(int __fd, mode_t __mode));
|
126 |
|
|
int _EXFUN(fstat,( int __fd, struct stat *__sbuf ));
|
127 |
|
|
int _EXFUN(mkdir,( const char *_path, mode_t __mode ));
|
128 |
|
|
int _EXFUN(mkfifo,( const char *__path, mode_t __mode ));
|
129 |
|
|
int _EXFUN(stat,( const char *__path, struct stat *__sbuf ));
|
130 |
|
|
mode_t _EXFUN(umask,( mode_t __mask ));
|
131 |
|
|
|
132 |
|
|
#if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
|
133 |
|
|
int _EXFUN(lstat,( const char *__path, struct stat *__buf ));
|
134 |
|
|
int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev ));
|
135 |
|
|
#endif
|
136 |
|
|
|
137 |
|
|
#if defined (__CYGWIN__) && !defined(__INSIDE_CYGWIN__)
|
138 |
|
|
int _EXFUN(fchmodat, (int, const char *, mode_t, int));
|
139 |
|
|
int _EXFUN(fstatat, (int, const char *, struct stat *, int));
|
140 |
|
|
int _EXFUN(mkdirat, (int, const char *, mode_t));
|
141 |
|
|
int _EXFUN(mkfifoat, (int, const char *, mode_t));
|
142 |
|
|
int _EXFUN(mknodat, (int, const char *, mode_t, dev_t));
|
143 |
|
|
int _EXFUN(utimensat, (int, const char *, const struct timespec *, int));
|
144 |
|
|
int _EXFUN(futimens, (int, const struct timespec *));
|
145 |
|
|
#endif
|
146 |
|
|
|
147 |
|
|
/* Provide prototypes for most of the _<systemcall> names that are
|
148 |
|
|
provided in newlib for some compilers. */
|
149 |
|
|
#ifdef _COMPILING_NEWLIB
|
150 |
|
|
int _EXFUN(_fstat,( int __fd, struct stat *__sbuf ));
|
151 |
|
|
int _EXFUN(_stat,( const char *__path, struct stat *__sbuf ));
|
152 |
|
|
#ifdef __LARGE64_FILES
|
153 |
|
|
struct stat64;
|
154 |
|
|
int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf ));
|
155 |
|
|
#endif
|
156 |
|
|
#endif
|
157 |
|
|
|
158 |
|
|
#endif /* !_STAT_H_ */
|
159 |
|
|
#ifdef __cplusplus
|
160 |
|
|
}
|
161 |
|
|
#endif
|
162 |
|
|
#endif /* _SYS_STAT_H */
|