ReactOS 0.4.16-dev-197-g92996da
stat.h
Go to the documentation of this file.
1
6#ifndef _INC_STAT
7#define _INC_STAT
8
9#ifndef _WIN32
10#error Only Win32 target is supported!
11#endif
12
13#include <crtdefs.h>
14
15#pragma pack(push,_CRT_PACKING)
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <sys/types.h>
22
23#ifndef _STAT_DEFINED
24#define _STAT_DEFINED
25
26 struct _stat32 {
29 unsigned short st_mode;
30 short st_nlink;
31 short st_uid;
32 short st_gid;
38 };
39
40 struct _stat {
43 unsigned short st_mode;
44 short st_nlink;
45 short st_uid;
46 short st_gid;
52 };
53
54#ifndef NO_OLDNAMES
55 struct stat {
58 unsigned short st_mode;
59 short st_nlink;
60 short st_uid;
61 short st_gid;
67 };
68#endif
69
70#if _INTEGRAL_MAX_BITS >= 64
71 struct _stat32i64 {
72 _dev_t st_dev;
73 _ino_t st_ino;
74 unsigned short st_mode;
75 short st_nlink;
76 short st_uid;
77 short st_gid;
78 _dev_t st_rdev;
79 __int64 st_size;
80 __time32_t st_atime;
81 __time32_t st_mtime;
82 __time32_t st_ctime;
83 };
84
85 struct _stat64i32 {
86 _dev_t st_dev;
87 _ino_t st_ino;
88 unsigned short st_mode;
89 short st_nlink;
90 short st_uid;
91 short st_gid;
92 _dev_t st_rdev;
93 _off_t st_size;
94 __time64_t st_atime;
95 __time64_t st_mtime;
96 __time64_t st_ctime;
97 };
98
99 struct _stat64 {
100 _dev_t st_dev;
101 _ino_t st_ino;
102 unsigned short st_mode;
103 short st_nlink;
104 short st_uid;
105 short st_gid;
106 _dev_t st_rdev;
107 __int64 st_size;
108 __time64_t st_atime;
109 __time64_t st_mtime;
110 __time64_t st_ctime;
111 };
112
113 struct _stati64 {
114 _dev_t st_dev;
115 _ino_t st_ino;
116 unsigned short st_mode;
117 short st_nlink;
118 short st_uid;
119 short st_gid;
120 _dev_t st_rdev;
121 __int64 st_size;
122 time_t st_atime;
123 time_t st_mtime;
124 time_t st_ctime;
125 };
126
127#endif /* _INTEGRAL_MAX_BITS >= 64 */
128
129#define __stat64 _stat64
130
131#endif /* !_STAT_DEFINED */
132
133#define _S_IFMT 0xF000
134#define _S_IFDIR 0x4000
135#define _S_IFCHR 0x2000
136#define _S_IFIFO 0x1000
137#define _S_IFREG 0x8000
138#define _S_IREAD 0x0100
139#define _S_IWRITE 0x0080
140#define _S_IEXEC 0x0040
141
142 _CRTIMP
143 int
144 __cdecl
146 _In_ int _FileDes,
147 _Out_ struct _stat *_Stat);
148
149 _CRTIMP
150 int
151 __cdecl
153 _In_ int _FileDes,
154 _Out_ struct _stat32 *_Stat);
155
156 _CRTIMP
157 int
158 __cdecl
160 _In_z_ const char *_Name,
161 _Out_ struct _stat *_Stat);
162
163 _CRTIMP
164 int
165 __cdecl
167 _In_z_ const char *_Name,
168 _Out_ struct _stat32 *_Stat);
169
170#if _INTEGRAL_MAX_BITS >= 64
171
172 _CRTIMP
173 int
174 __cdecl
175 _fstat64(
176 _In_ int _FileDes,
177 _Out_ struct _stat64 *_Stat);
178
179 _CRTIMP
180 int
181 __cdecl
183 _In_ int _FileDes,
184 _Out_ struct _stat32i64 *_Stat);
185
186 _CRTIMP
187 int
188 __cdecl
190 _In_ int _FileDes,
191 _Out_ struct _stat64i32 *_Stat);
192
193 _CRTIMP
194 int
195 __cdecl
196 _stat64(
197 _In_z_ const char *_Name,
198 _Out_ struct _stat64 *_Stat);
199
200 _CRTIMP
201 int
202 __cdecl
203 _stat32i64(
204 _In_z_ const char *_Name,
205 _Out_ struct _stat32i64 *_Stat);
206
207 _CRTIMP
208 int
209 __cdecl
210 _stat64i32(
211 _In_z_ const char *_Name,
212 _Out_ struct _stat64i32 *_Stat);
213
214#endif /* _INTEGRAL_MAX_BITS >= 64 */
215
216#ifndef _WSTAT_DEFINED
217#define _WSTAT_DEFINED
218
219 _CRTIMP
220 int
221 __cdecl
223 _In_z_ const wchar_t *_Name,
224 _Out_ struct _stat *_Stat);
225
226 _CRTIMP
227 int
228 __cdecl
230 _In_z_ const wchar_t *_Name,
231 _Out_ struct _stat32 *_Stat);
232
233#if _INTEGRAL_MAX_BITS >= 64
234 _CRTIMP
235 int
236 __cdecl
237 _wstat32i64(
238 _In_z_ const wchar_t *_Name,
239 _Out_ struct _stat32i64 *_Stat);
240
241 _CRTIMP
242 int
243 __cdecl
244 _wstat64i32(
245 _In_z_ const wchar_t *_Name,
246 _Out_ struct _stat64i32 *_Stat);
247
248 _CRTIMP
249 int
250 __cdecl
251 _wstat64(
252 _In_z_ const wchar_t *_Name,
253 _Out_ struct _stat64 *_Stat);
254
255#endif /* _INTEGRAL_MAX_BITS >= 64 */
256
257#endif /* _WSTAT_DEFINED */
258
259
262#if !defined(RC_INVOKED)
263
264#ifdef _USE_32BIT_TIME_T
265 #define _fstat32 _fstat
266 #define _fstat32i64 _fstati64
267 #define _fstat64i32 _fstat64
268#else
269 #define _fstat64i32 _fstat
270 __CRT_INLINE int __cdecl _fstat32(int _FileDes, struct _stat32 *_Stat)
271 {
272 struct _stat _Stat64;
273 int ret = _fstat(_FileDes, &_Stat64);
274 _Stat->st_dev = _Stat64.st_dev;
275 _Stat->st_ino = _Stat64.st_ino;
276 _Stat->st_mode = _Stat64.st_mode;
277 _Stat->st_nlink = _Stat64.st_nlink;
278 _Stat->st_uid = _Stat64.st_uid;
279 _Stat->st_gid = _Stat64.st_gid;
280 _Stat->st_rdev = _Stat64.st_rdev;
281 _Stat->st_size = _Stat64.st_size;
282 _Stat->st_atime = (__time32_t)_Stat64.st_atime;
283 _Stat->st_mtime = (__time32_t)_Stat64.st_mtime;
284 _Stat->st_ctime = (__time32_t)_Stat64.st_ctime;
285 return ret;
286 }
287 __CRT_INLINE int __cdecl _fstat32i64(int _FileDes, struct _stat32i64 *_Stat)
288 {
289 struct _stat64 _Stat64;
290 int ret = _fstat64(_FileDes, &_Stat64);
291 _Stat->st_dev = _Stat64.st_dev;
292 _Stat->st_ino = _Stat64.st_ino;
293 _Stat->st_mode = _Stat64.st_mode;
294 _Stat->st_nlink = _Stat64.st_nlink;
295 _Stat->st_uid = _Stat64.st_uid;
296 _Stat->st_gid = _Stat64.st_gid;
297 _Stat->st_rdev = _Stat64.st_rdev;
298 _Stat->st_size = _Stat64.st_size;
299 _Stat->st_atime = (__time32_t)_Stat64.st_atime;
300 _Stat->st_mtime = (__time32_t)_Stat64.st_mtime;
301 _Stat->st_ctime = (__time32_t)_Stat64.st_ctime;
302 return ret;
303 }
304#endif /* _USE_32BIT_TIME_T */
305
306#endif /* !defined(RC_INVOKED) */
307
308#ifndef NO_OLDNAMES
309#define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
310
311#define S_IFMT _S_IFMT
312#define S_IFDIR _S_IFDIR
313#define S_IFCHR _S_IFCHR
314#define S_IFREG _S_IFREG
315#define S_IREAD _S_IREAD
316#define S_IWRITE _S_IWRITE
317#define S_IEXEC _S_IEXEC
318#define S_IFIFO _S_IFIFO
319#define S_IFBLK _S_IFBLK
320
321#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
322#define _S_IXUSR _S_IEXEC
323#define _S_IWUSR _S_IWRITE
324
325#define S_IRWXU _S_IRWXU
326#define S_IXUSR _S_IXUSR
327#define S_IWUSR _S_IWUSR
328#define S_IRUSR _S_IRUSR
329#define _S_IRUSR _S_IREAD
330
331#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
332#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
333#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
334#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
335#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
336
337#if !defined (RC_INVOKED)
338 _CRTIMP int __cdecl stat(const char *_Filename,struct stat *_Stat);
339 _CRTIMP int __cdecl fstat(int _Desc,struct stat *_Stat);
340 _CRTIMP int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat);
341__CRT_INLINE int __cdecl fstat(int _Desc,struct stat *_Stat) {
342 return _fstat(_Desc,(struct _stat *)_Stat);
343}
344
345__CRT_INLINE int __cdecl stat(const char *_Filename,struct stat *_Stat) {
346 return _stat(_Filename,(struct _stat *)_Stat);
347}
348
349__CRT_INLINE int __cdecl wstat(const wchar_t *_Filename,struct stat *_Stat) {
350 return _wstat(_Filename,(struct _stat *)_Stat);
351}
352
353#endif
354
355#endif /* !NO_OLDNAMES */
356
357
358#ifdef __cplusplus
359}
360#endif
361
362#pragma pack(pop)
363#endif
#define __cdecl
Definition: accygwin.h:79
#define stat
Definition: acwin.h:99
#define fstat
Definition: acwin.h:100
#define __int64
Definition: basetyps.h:16
st_mode
Definition: cpu_i386.c:139
#define _CRTIMP
Definition: crtdefs.h:81
long __time32_t
Definition: crtdefs.h:380
__kernel_time_t time_t
Definition: linux.h:252
long _off_t
Definition: stdio.h:73
_CRTIMP int __cdecl _fstat(_In_ int _FileDes, _Out_ struct _stat *_Stat)
_CRTIMP int __cdecl wstat(const wchar_t *_Filename, struct stat *_Stat)
Definition: stat.h:349
__CRT_INLINE int __cdecl _fstat32i64(int _FileDes, struct _stat32i64 *_Stat)
Definition: stat.h:287
_CRTIMP int __cdecl _wstat(_In_z_ const wchar_t *_Name, _Out_ struct _stat *_Stat)
_CRTIMP int __cdecl _wstat32(_In_z_ const wchar_t *_Name, _Out_ struct _stat32 *_Stat)
#define _fstat64i32
Definition: stat.h:269
_CRTIMP int __cdecl _fstat32(_In_ int _FileDes, _Out_ struct _stat32 *_Stat)
unsigned short _ino_t
Definition: wchar.h:607
long _off_t
Definition: wchar.h:623
unsigned int _dev_t
Definition: wchar.h:615
#define _In_z_
Definition: ms_sal.h:313
#define _Out_
Definition: ms_sal.h:345
#define _In_
Definition: ms_sal.h:308
unsigned short _ino_t
Definition: types.h:17
unsigned int _dev_t
Definition: types.h:25
int CDECL _fstat64(int fd, struct __stat64 *buf)
Definition: stat64.c:102
Definition: stat.h:26
short st_uid
Definition: stat.h:31
_dev_t st_rdev
Definition: stat.h:33
short st_gid
Definition: stat.h:32
unsigned short st_mode
Definition: stat.h:29
__time32_t st_mtime
Definition: stat.h:36
_dev_t st_dev
Definition: stat.h:27
__time32_t st_ctime
Definition: stat.h:37
_ino_t st_ino
Definition: stat.h:28
__time32_t st_atime
Definition: stat.h:35
short st_nlink
Definition: stat.h:30
_off_t st_size
Definition: stat.h:34
Definition: stat.h:40
time_t st_ctime
Definition: stat.h:51
time_t st_mtime
Definition: stat.h:50
_off_t st_size
Definition: stat.h:48
short st_nlink
Definition: stat.h:44
short st_uid
Definition: stat.h:45
_dev_t st_dev
Definition: stat.h:41
_ino_t st_ino
Definition: stat.h:42
unsigned short st_mode
Definition: stat.h:43
time_t st_atime
Definition: stat.h:49
short st_gid
Definition: stat.h:46
_dev_t st_rdev
Definition: stat.h:47
Definition: stat.h:55
time_t st_ctime
Definition: stat.h:66
short st_gid
Definition: stat.h:61
unsigned short st_mode
Definition: stat.h:58
time_t st_mtime
Definition: stat.h:65
_dev_t st_dev
Definition: stat.h:56
short st_uid
Definition: stat.h:60
_ino_t st_ino
Definition: stat.h:57
_dev_t st_rdev
Definition: stat.h:62
_off_t st_size
Definition: stat.h:63
time_t st_atime
Definition: stat.h:64
short st_nlink
Definition: stat.h:59
int ret