2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
10 #error Only Win32 target is supported!
15 #pragma pack(push,_CRT_PACKING)
21 #include <sys/types.h>
29 unsigned short st_mode
;
43 unsigned short st_mode
;
58 unsigned short st_mode
;
70 #if _INTEGRAL_MAX_BITS >= 64
74 unsigned short st_mode
;
88 unsigned short st_mode
;
102 unsigned short st_mode
;
116 unsigned short st_mode
;
127 #endif /* _INTEGRAL_MAX_BITS >= 64 */
129 #define __stat64 _stat64
131 #endif /* !_STAT_DEFINED */
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
147 _Out_
struct _stat
*_Stat
);
154 _Out_
struct _stat32
*_Stat
);
160 _In_z_
const char *_Name
,
161 _Out_
struct _stat
*_Stat
);
167 _In_z_
const char *_Name
,
168 _Out_
struct _stat32
*_Stat
);
170 #if _INTEGRAL_MAX_BITS >= 64
177 _Out_
struct _stat64
*_Stat
);
184 _Out_
struct _stat32i64
*_Stat
);
191 _Out_
struct _stat64i32
*_Stat
);
197 _In_z_
const char *_Name
,
198 _Out_
struct _stat64
*_Stat
);
204 _In_z_
const char *_Name
,
205 _Out_
struct _stat32i64
*_Stat
);
211 _In_z_
const char *_Name
,
212 _Out_
struct _stat64i32
*_Stat
);
214 #endif /* _INTEGRAL_MAX_BITS >= 64 */
216 #ifndef _WSTAT_DEFINED
217 #define _WSTAT_DEFINED
223 _In_z_
const wchar_t *_Name
,
224 _Out_
struct _stat
*_Stat
);
230 _In_z_
const wchar_t *_Name
,
231 _Out_
struct _stat32
*_Stat
);
233 #if _INTEGRAL_MAX_BITS >= 64
238 _In_z_
const wchar_t *_Name
,
239 _Out_
struct _stat32i64
*_Stat
);
245 _In_z_
const wchar_t *_Name
,
246 _Out_
struct _stat64i32
*_Stat
);
252 _In_z_
const wchar_t *_Name
,
253 _Out_
struct _stat64
*_Stat
);
255 #endif /* _INTEGRAL_MAX_BITS >= 64 */
257 #endif /* _WSTAT_DEFINED */
260 /** Compatibility definitons *************************************************/
262 #if !defined(RC_INVOKED)
264 #ifdef _USE_32BIT_TIME_T
265 #define _fstat32 _fstat
266 #define _fstat32i64 _fstati64
267 #define _fstat64i32 _fstat64
269 #define _fstat64i32 _fstat
270 __CRT_INLINE
int __cdecl
_fstat32(int _FileDes
, struct _stat32
*_Stat
)
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
;
287 __CRT_INLINE
int __cdecl
_fstat32i64(int _FileDes
, struct _stat32i64
*_Stat
)
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
;
304 #endif /* _USE_32BIT_TIME_T */
306 #endif /* !defined(RC_INVOKED) */
309 #define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
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
321 #define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
322 #define _S_IXUSR _S_IEXEC
323 #define _S_IWUSR _S_IWRITE
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
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)
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
);
345 __CRT_INLINE
int __cdecl
stat(const char *_Filename
,struct stat
*_Stat
) {
346 return _stat(_Filename
,(struct _stat
*)_Stat
);
349 __CRT_INLINE
int __cdecl
wstat(const wchar_t *_Filename
,struct stat
*_Stat
) {
350 return _wstat(_Filename
,(struct _stat
*)_Stat
);
355 #endif /* !NO_OLDNAMES */