ReactOS  0.4.14-dev-115-g4576127
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
18 extern "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;
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;
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;
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
145  _fstat(
146  _In_ int _FileDes,
147  _Out_ struct _stat *_Stat);
148 
149  _CRTIMP
150  int
151  __cdecl
152  _fstat32(
153  _In_ int _FileDes,
154  _Out_ struct _stat32 *_Stat);
155 
156  _CRTIMP
157  int
158  __cdecl
159  _stat(
160  _In_z_ const char *_Name,
161  _Out_ struct _stat *_Stat);
162 
163  _CRTIMP
164  int
165  __cdecl
166  _stat32(
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
182  _fstat32i64(
183  _In_ int _FileDes,
184  _Out_ struct _stat32i64 *_Stat);
185 
186  _CRTIMP
187  int
188  __cdecl
189  _fstat64i32(
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
222  _wstat(
223  _In_z_ const wchar_t *_Name,
224  _Out_ struct _stat *_Stat);
225 
226  _CRTIMP
227  int
228  __cdecl
229  _wstat32(
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
short st_nlink
Definition: stat.h:59
_CRTIMP int __cdecl _stat32(_In_z_ const char *_Name, _Out_ struct _stat32 *_Stat)
__MINGW_EXTENSION __int64 st_size
Definition: wchar.h:700
_dev_t st_rdev
Definition: stat.h:33
_ino_t st_ino
Definition: wchar.h:694
_dev_t st_dev
Definition: wchar.h:721
_CRTIMP int __cdecl _wstat32(_In_z_ const wchar_t *_Name, _Out_ struct _stat32 *_Stat)
#define __cdecl
Definition: accygwin.h:79
time_t st_ctime
Definition: stat.h:66
__time32_t st_ctime
Definition: wchar.h:703
#define _CRTIMP
Definition: crtdefs.h:60
short st_nlink
Definition: stat.h:44
__time32_t st_atime
Definition: stat.h:35
Definition: stat.h:40
long __time32_t
Definition: crtdefs.h:358
_dev_t st_dev
Definition: wchar.h:693
_dev_t st_rdev
Definition: wchar.h:713
short st_uid
Definition: wchar.h:711
unsigned short st_mode
Definition: wchar.h:723
unsigned short st_mode
Definition: wchar.h:695
__time64_t st_atime
Definition: wchar.h:729
__time32_t st_ctime
Definition: stat.h:37
__time32_t st_mtime
Definition: wchar.h:702
_ino_t st_ino
Definition: stat.h:42
short st_gid
Definition: stat.h:32
_ino_t st_ino
Definition: stat.h:57
_dev_t st_rdev
Definition: wchar.h:699
short st_uid
Definition: stat.h:60
_CRTIMP int __cdecl wstat(const wchar_t *_Filename, struct stat *_Stat)
Definition: stat.h:349
_dev_t st_rdev
Definition: wchar.h:727
short st_gid
Definition: wchar.h:698
short st_uid
Definition: wchar.h:697
unsigned short _ino_t
Definition: types.h:17
time_t st_mtime
Definition: stat.h:50
_off_t st_size
Definition: stat.h:48
short st_gid
Definition: stat.h:61
__time64_t st_atime
Definition: wchar.h:715
#define _Out_
Definition: no_sal2.h:323
int CDECL _fstat64(int fd, struct __stat64 *buf)
Definition: stat64.c:102
_dev_t st_dev
Definition: stat.h:56
short st_nlink
Definition: wchar.h:710
_off_t st_size
Definition: stat.h:34
Definition: wchar.h:720
__time64_t st_ctime
Definition: wchar.h:731
short st_gid
Definition: wchar.h:726
_dev_t st_dev
Definition: wchar.h:707
short st_nlink
Definition: stat.h:30
__time64_t st_mtime
Definition: wchar.h:730
__CRT_INLINE int __cdecl _fstat32i64(int _FileDes, struct _stat32i64 *_Stat)
Definition: stat.h:287
int ret
unsigned short st_mode
Definition: stat.h:29
short st_uid
Definition: stat.h:31
unsigned short st_mode
Definition: stat.h:58
Definition: stat.h:55
_dev_t st_rdev
Definition: stat.h:62
_CRTIMP int __cdecl _fstat32(_In_ int _FileDes, _Out_ struct _stat32 *_Stat)
_CRTIMP int __cdecl _stat(_In_z_ const char *_Name, _Out_ struct _stat *_Stat)
#define _fstat64i32
Definition: stat.h:269
_CRTIMP int __cdecl _wstat32i64(_In_z_ const wchar_t *_Name, _Out_ struct _stat32i64 *_Stat)
__time32_t st_mtime
Definition: stat.h:36
_CRTIMP int __cdecl _fstat(_In_ int _FileDes, _Out_ struct _stat *_Stat)
#define _In_
Definition: no_sal2.h:204
__time64_t st_mtime
Definition: wchar.h:716
_ino_t st_ino
Definition: wchar.h:722
_dev_t st_dev
Definition: stat.h:41
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
st_mode
Definition: cpu_i386.c:143
__time64_t st_ctime
Definition: wchar.h:717
_ino_t st_ino
Definition: stat.h:28
short st_uid
Definition: stat.h:45
short st_gid
Definition: wchar.h:712
__kernel_time_t time_t
Definition: linux.h:252
#define _In_z_
Definition: no_sal2.h:239
time_t st_atime
Definition: stat.h:64
short st_uid
Definition: wchar.h:725
unsigned short st_mode
Definition: wchar.h:709
short st_nlink
Definition: wchar.h:724
short st_nlink
Definition: wchar.h:696
time_t st_atime
Definition: stat.h:49
_ino_t st_ino
Definition: wchar.h:708
long _off_t
Definition: stdio.h:81
Definition: stat.h:26
unsigned int _dev_t
Definition: types.h:25
_CRTIMP int __cdecl fstat(int _Desc, struct stat *_Stat)
Definition: stat.h:341
_CRTIMP int __cdecl _wstat64i32(_In_z_ const wchar_t *_Name, _Out_ struct _stat64i32 *_Stat)
_dev_t st_dev
Definition: stat.h:27
_CRTIMP int __cdecl _wstat(_In_z_ const wchar_t *_Name, _Out_ struct _stat *_Stat)
_dev_t st_rdev
Definition: stat.h:47
time_t st_ctime
Definition: stat.h:51
time_t st_mtime
Definition: stat.h:65
_CRTIMP int __cdecl _wstat64(_In_z_ const wchar_t *_Name, _Out_ struct _stat64 *_Stat)
__time32_t st_atime
Definition: wchar.h:701
_off_t st_size
Definition: wchar.h:714
short st_gid
Definition: stat.h:46
unsigned short st_mode
Definition: stat.h:43
#define __int64
Definition: basetyps.h:16
__MINGW_EXTENSION typedef __int64 __time64_t
Definition: crtdefs.h:364
_off_t st_size
Definition: stat.h:63
__MINGW_EXTENSION __int64 st_size
Definition: wchar.h:728