1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef INC_SYS_STAT_H_
22 #define INC_SYS_STAT_H_
23
24 #ifdef __MINGW32__
25 # include <_mingw.h>
26 #endif
27
28
29 #ifndef __MINGW_NOTHROW
30 # define __MINGW_NOTHROW
31 #endif
32
33
34 #ifndef _SYS_STAT_H
35 # define _SYS_STAT_H
36 #endif
37 #ifndef _INC_STAT_H
38 # define _INC_STAT_H
39 #endif
40
41 #include <sys/types.h>
42 #include <time.h>
43
44 #define S_IFMT 0xF800
45
46 #define S_IFREG 0x8000
47 #define S_IFDIR 0x4000
48 #define S_IFBLK 0x3000
49 #define S_IFCHR 0x2000
50 #define S_IFIFO 0x1000
51 #define S_IFLNK 0x0800
52
53 #define S_IREAD 0x0100
54 #define S_IWRITE 0x0080
55 #define S_IEXEC 0x0040
56
57 #define S_IRUSR S_IREAD
58 #define S_IWUSR S_IWRITE
59 #define S_IXUSR S_IEXEC
60 #define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC)
61
62 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
63 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
64 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
65 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
66 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
67 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
68
69
70 #define S_ISUID 0
71 #define S_ISGID 0
72 #define S_ISVTX 0
73 #define S_IRGRP (S_IRUSR >> 3)
74 #define S_IROTH (S_IRUSR >> 6)
75 #define S_IWGRP (S_IWUSR >> 3)
76 #define S_IWOTH (S_IWUSR >> 6)
77 #define S_IXGRP (S_IXUSR >> 3)
78 #define S_IXOTH (S_IXUSR >> 6)
79
80 #define S_ISSOCK(m) 0
81 #define S_ISCTG(p) 0
82 #define S_ISDOOR(m) 0
83 #define S_ISMPB(m) 0
84 #define S_ISMPC(m) 0
85 #define S_ISMPX(m) 0
86 #define S_ISNWK(m) 0
87 #define S_ISPORT(m) 0
88 #define S_ISWHT(m) 0
89 #define S_TYPEISMQ(p) 0
90 #define S_TYPEISSEM(p) 0
91 #define S_TYPEISSHM(p) 0
92 #define S_TYPEISTMO(p) 0
93
94 #define UTIME_NOW (-1)
95 #define UTIME_OMIT (-2)
96
97 struct stat {
98 unsigned __int64 st_ino;
99 dev_t st_dev;
100 unsigned short st_mode;
101 short st_nlink;
102 unsigned st_uid;
103 unsigned st_gid;
104 unsigned __int64 st_size;
105 dev_t st_rdev;
106 time_t st_atime;
107 time_t st_mtime;
108 time_t st_ctime;
109 char st_uname[260];
110 char st_gname[260];
111 };
112
113
114 struct _stat
115 {
116 _dev_t st_dev;
117 _ino_t st_ino;
118 _mode_t st_mode;
119 short st_nlink;
120 short st_uid;
121 short st_gid;
122 _dev_t st_rdev;
123 _off_t st_size;
124 time_t st_atime;
125
126 time_t st_mtime;
127 time_t st_ctime;
128 };
129
130 #if defined (__MSVCRT__)
131 struct _stati64 {
132 _dev_t st_dev;
133 _ino_t st_ino;
134 _mode_t st_mode;
135 short st_nlink;
136 short st_uid;
137 short st_gid;
138 _dev_t st_rdev;
139 __int64 st_size;
140 time_t st_atime;
141 time_t st_mtime;
142 time_t st_ctime;
143 };
144 #endif
145
146
147
148 extern int w32_stat_get_owner_group;
149
150
151 #define _STAT_DEFINED
152
153
154
155
156
157
158 #define _WSTAT_DEFINED
159
160 int __cdecl __MINGW_NOTHROW fstat (int, struct stat*);
161 int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*);
162 int __cdecl __MINGW_NOTHROW lstat (const char*, struct stat*);
163 int __cdecl __MINGW_NOTHROW fstatat (int, char const *,
164 struct stat *, int);
165 int __cdecl __MINGW_NOTHROW chmod (const char*, int);
166
167
168
169
170 extern int utimensat (int, const char *, struct timespec const[2], int);
171
172 #endif