f8f280c70371db08dd1ab8eb59a128c4306208ee
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!
16 #pragma pack(push,_CRT_PACKING)
23 #define _CRTIMP __declspec(dllimport)
26 #include <sys/types.h>
28 #ifdef _USE_32BIT_TIME_T
30 #undef _USE_32BIT_TIME_T
33 #if _INTEGRAL_MAX_BITS < 64
34 #define _USE_32BIT_TIME_T
38 #ifndef _TIME32_T_DEFINED
39 typedef long __time32_t
;
40 #define _TIME32_T_DEFINED
43 #ifndef _TIME64_T_DEFINED
44 #if _INTEGRAL_MAX_BITS >= 64
45 typedef __int64 __time64_t
;
47 #define _TIME64_T_DEFINED
50 #ifndef _TIME_T_DEFINED
51 #ifdef _USE_32BIT_TIME_T
52 typedef __time32_t
time_t;
54 typedef __time64_t
time_t;
56 #define _TIME_T_DEFINED
59 #ifndef _WCHAR_T_DEFINED
60 typedef unsigned short wchar_t;
61 #define _WCHAR_T_DEFINED
69 unsigned short st_mode
;
83 unsigned short st_mode
;
98 unsigned short st_mode
;
110 /* #if _INTEGRAL_MAX_BITS >= 64 */
115 unsigned short st_mode
;
129 unsigned short st_mode
;
143 unsigned short st_mode
;
157 unsigned short st_mode
;
170 #define __stat64 _stat64
172 #define _STAT_DEFINED
173 #endif /* !_STAT_DEFINED */
175 #define _S_IFMT 0xF000
176 #define _S_IFDIR 0x4000
177 #define _S_IFCHR 0x2000
178 #define _S_IFIFO 0x1000
179 #define _S_IFREG 0x8000
180 #define _S_IREAD 0x0100
181 #define _S_IWRITE 0x0080
182 #define _S_IEXEC 0x0040
184 _CRTIMP
int __cdecl
_fstat(int _FileDes
,struct _stat
*_Stat
);
185 _CRTIMP
int __cdecl
_fstat32(int _FileDes
,struct _stat32
*_Stat
);
186 _CRTIMP
int __cdecl
_stat(const char *_Name
,struct _stat
*_Stat
);
187 _CRTIMP
int __cdecl
_stat32(const char *_Name
,struct _stat32
*_Stat
);
189 #if _INTEGRAL_MAX_BITS >= 64
190 _CRTIMP
int __cdecl
_fstat64(int _FileDes
,struct _stat64
*_Stat
);
191 _CRTIMP
int __cdecl
_fstat32i64(int _FileDes
,struct _stat32i64
*_Stat
);
192 int __cdecl
_fstat64i32(int _FileDes
,struct _stat64i32
*_Stat
);
193 __CRT_INLINE
int __cdecl
_fstat64i32(int _FileDes
,struct _stat64i32
*_Stat
)
196 int ret
=_fstat64(_FileDes
,&st
);
197 _Stat
->st_dev
=st
.st_dev
;
198 _Stat
->st_ino
=st
.st_ino
;
199 _Stat
->st_mode
=st
.st_mode
;
200 _Stat
->st_nlink
=st
.st_nlink
;
201 _Stat
->st_uid
=st
.st_uid
;
202 _Stat
->st_gid
=st
.st_gid
;
203 _Stat
->st_rdev
=st
.st_rdev
;
204 _Stat
->st_size
=(_off_t
) st
.st_size
;
205 _Stat
->st_atime
=st
.st_atime
;
206 _Stat
->st_mtime
=st
.st_mtime
;
207 _Stat
->st_ctime
=st
.st_ctime
;
211 _CRTIMP
int __cdecl
_stat64(const char *_Name
,struct _stat64
*_Stat
);
212 _CRTIMP
int __cdecl
_stat32i64(const char *_Name
,struct _stat32i64
*_Stat
);
213 int __cdecl
_stat64i32(const char *_Name
,struct _stat64i32
*_Stat
);
214 __CRT_INLINE
int __cdecl
_stat64i32(const char *_Name
,struct _stat64i32
*_Stat
)
217 int ret
=_stat64(_Name
,&st
);
218 _Stat
->st_dev
=st
.st_dev
;
219 _Stat
->st_ino
=st
.st_ino
;
220 _Stat
->st_mode
=st
.st_mode
;
221 _Stat
->st_nlink
=st
.st_nlink
;
222 _Stat
->st_uid
=st
.st_uid
;
223 _Stat
->st_gid
=st
.st_gid
;
224 _Stat
->st_rdev
=st
.st_rdev
;
225 _Stat
->st_size
=(_off_t
) st
.st_size
;
226 _Stat
->st_atime
=st
.st_atime
;
227 _Stat
->st_mtime
=st
.st_mtime
;
228 _Stat
->st_ctime
=st
.st_ctime
;
233 #ifndef _WSTAT_DEFINED
234 #define _WSTAT_DEFINED
235 _CRTIMP
int __cdecl
_wstat(const wchar_t *_Name
,struct _stat
*_Stat
);
236 _CRTIMP
int __cdecl
_wstat32(const wchar_t *_Name
,struct _stat32
*_Stat
);
237 _CRTIMP
int __cdecl
_wstati64(const wchar_t *_Name
,struct _stati64
*_Stat
);
238 #if _INTEGRAL_MAX_BITS >= 64
239 _CRTIMP
int __cdecl
_wstat32i64(const wchar_t *_Name
,struct _stat32i64
*_Stat
);
240 _CRTIMP
int __cdecl
_wstat64i32(const wchar_t *_Name
,struct _stat64i32
*_Stat
);
241 _CRTIMP
int __cdecl
_wstat64(const wchar_t *_Name
,struct _stat64
*_Stat
);
246 #define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
248 #define S_IFMT _S_IFMT
249 #define S_IFDIR _S_IFDIR
250 #define S_IFCHR _S_IFCHR
251 #define S_IFREG _S_IFREG
252 #define S_IREAD _S_IREAD
253 #define S_IWRITE _S_IWRITE
254 #define S_IEXEC _S_IEXEC
255 #define S_IFIFO _S_IFIFO
256 #define S_IFBLK _S_IFBLK
258 #define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
259 #define _S_IXUSR _S_IEXEC
260 #define _S_IWUSR _S_IWRITE
262 #define S_IRWXU _S_IRWXU
263 #define S_IXUSR _S_IXUSR
264 #define S_IWUSR _S_IWUSR
265 #define S_IRUSR _S_IRUSR
266 #define _S_IRUSR _S_IREAD
268 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
269 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
270 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
271 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
272 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
276 #if !defined (RC_INVOKED) && !defined (NO_OLDNAMES)
277 int __cdecl
stat(const char *_Filename
,struct stat
*_Stat
);
278 int __cdecl
fstat(int _Desc
,struct stat
*_Stat
);
279 int __cdecl
wstat(const wchar_t *_Filename
,struct stat
*_Stat
);
281 __CRT_INLINE
int __cdecl
fstat(int _Desc
,struct stat
*_Stat
) {
282 return _fstat(_Desc
,(struct _stat
*)_Stat
);
285 __CRT_INLINE
int __cdecl
stat(const char *_Filename
,struct stat
*_Stat
) {
286 return _stat(_Filename
,(struct _stat
*)_Stat
);
289 __CRT_INLINE
int __cdecl
wstat(const wchar_t *_Filename
,struct stat
*_Stat
) {
290 return _wstat(_Filename
,(struct _stat
*)_Stat
);