8f8b0b29f6d3a004399d518ffb89eeabefdd6e58
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 #ifndef __TINYC__ //gr
29 #ifdef _USE_32BIT_TIME_T
31 #undef _USE_32BIT_TIME_T
34 #if _INTEGRAL_MAX_BITS < 64
35 #define _USE_32BIT_TIME_T
40 #ifndef _TIME32_T_DEFINED
41 typedef long __time32_t
;
42 #define _TIME32_T_DEFINED
45 #ifndef _TIME64_T_DEFINED
46 #if _INTEGRAL_MAX_BITS >= 64
47 typedef __int64 __time64_t
;
49 #define _TIME64_T_DEFINED
52 #ifndef _TIME_T_DEFINED
53 #ifdef _USE_32BIT_TIME_T
54 typedef __time32_t
time_t;
56 typedef __time64_t
time_t;
58 #define _TIME_T_DEFINED
61 #ifndef _WCHAR_T_DEFINED
62 typedef unsigned short wchar_t;
63 #define _WCHAR_T_DEFINED
68 #ifdef _USE_32BIT_TIME_T
70 #define _fstat32 _fstat
72 #define _wstat32 _wstat
74 #define _fstat _fstat32
76 #define _wstat _wstat32
78 #define _fstati64 _fstat32i64
79 #define _stati64 _stat32i64
80 #define _wstati64 _wstat32i64
82 #define _fstat _fstat64i32
83 #define _fstati64 _fstat64
84 #define _stat _stat64i32
85 #define _stati64 _stat64
86 #define _wstat _wstat64i32
87 #define _wstati64 _wstat64
93 unsigned short st_mode
;
108 unsigned short st_mode
;
120 #if _INTEGRAL_MAX_BITS >= 64
124 unsigned short st_mode
;
138 unsigned short st_mode
;
152 unsigned short st_mode
;
164 #define __stat64 _stat64
166 #define _STAT_DEFINED
169 #define _S_IFMT 0xF000
170 #define _S_IFDIR 0x4000
171 #define _S_IFCHR 0x2000
172 #define _S_IFIFO 0x1000
173 #define _S_IFREG 0x8000
174 #define _S_IREAD 0x0100
175 #define _S_IWRITE 0x0080
176 #define _S_IEXEC 0x0040
178 _CRTIMP
int __cdecl
_fstat32(int _FileDes
,struct _stat32
*_Stat
);
179 _CRTIMP
int __cdecl
_stat32(const char *_Name
,struct _stat32
*_Stat
);
180 #if _INTEGRAL_MAX_BITS >= 64
181 _CRTIMP
int __cdecl
_fstat64(int _FileDes
,struct _stat64
*_Stat
);
182 _CRTIMP
int __cdecl
_fstat32i64(int _FileDes
,struct _stat32i64
*_Stat
);
183 int __cdecl
_fstat64i32(int _FileDes
,struct _stat64i32
*_Stat
);
184 __CRT_INLINE
int __cdecl
_fstat64i32(int _FileDes
,struct _stat64i32
*_Stat
)
187 int ret
=_fstat64(_FileDes
,&st
);
188 _Stat
->st_dev
=st
.st_dev
;
189 _Stat
->st_ino
=st
.st_ino
;
190 _Stat
->st_mode
=st
.st_mode
;
191 _Stat
->st_nlink
=st
.st_nlink
;
192 _Stat
->st_uid
=st
.st_uid
;
193 _Stat
->st_gid
=st
.st_gid
;
194 _Stat
->st_rdev
=st
.st_rdev
;
195 _Stat
->st_size
=(_off_t
) st
.st_size
;
196 _Stat
->st_atime
=st
.st_atime
;
197 _Stat
->st_mtime
=st
.st_mtime
;
198 _Stat
->st_ctime
=st
.st_ctime
;
201 _CRTIMP
int __cdecl
_stat64(const char *_Name
,struct _stat64
*_Stat
);
202 _CRTIMP
int __cdecl
_stat32i64(const char *_Name
,struct _stat32i64
*_Stat
);
203 int __cdecl
_stat64i32(const char *_Name
,struct _stat64i32
*_Stat
);
204 __CRT_INLINE
int __cdecl
_stat64i32(const char *_Name
,struct _stat64i32
*_Stat
)
207 int ret
=_stat64(_Name
,&st
);
208 _Stat
->st_dev
=st
.st_dev
;
209 _Stat
->st_ino
=st
.st_ino
;
210 _Stat
->st_mode
=st
.st_mode
;
211 _Stat
->st_nlink
=st
.st_nlink
;
212 _Stat
->st_uid
=st
.st_uid
;
213 _Stat
->st_gid
=st
.st_gid
;
214 _Stat
->st_rdev
=st
.st_rdev
;
215 _Stat
->st_size
=(_off_t
) st
.st_size
;
216 _Stat
->st_atime
=st
.st_atime
;
217 _Stat
->st_mtime
=st
.st_mtime
;
218 _Stat
->st_ctime
=st
.st_ctime
;
223 #ifndef _WSTAT_DEFINED
224 #define _WSTAT_DEFINED
225 _CRTIMP
int __cdecl
_wstat32(const wchar_t *_Name
,struct _stat32
*_Stat
);
226 #if _INTEGRAL_MAX_BITS >= 64
227 _CRTIMP
int __cdecl
_wstat32i64(const wchar_t *_Name
,struct _stat32i64
*_Stat
);
228 int __cdecl
_wstat64i32(const wchar_t *_Name
,struct _stat64i32
*_Stat
);
229 _CRTIMP
int __cdecl
_wstat64(const wchar_t *_Name
,struct _stat64
*_Stat
);
234 #define _S_IFBLK 0x3000 /* Block: Is this ever set under w32? */
236 #define S_IFMT _S_IFMT
237 #define S_IFDIR _S_IFDIR
238 #define S_IFCHR _S_IFCHR
239 #define S_IFREG _S_IFREG
240 #define S_IREAD _S_IREAD
241 #define S_IWRITE _S_IWRITE
242 #define S_IEXEC _S_IEXEC
243 #define S_IFIFO _S_IFIFO
244 #define S_IFBLK _S_IFBLK
246 #define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
247 #define _S_IXUSR _S_IEXEC
248 #define _S_IWUSR _S_IWRITE
250 #define S_IRWXU _S_IRWXU
251 #define S_IXUSR _S_IXUSR
252 #define S_IWUSR _S_IWUSR
253 #define S_IRUSR _S_IRUSR
254 #define _S_IRUSR _S_IREAD
256 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
257 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
258 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
259 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
260 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
264 #if !defined (RC_INVOKED) && !defined (NO_OLDNAMES)
265 int __cdecl
stat(const char *_Filename
,struct stat
*_Stat
);
266 int __cdecl
fstat(int _Desc
,struct stat
*_Stat
);
267 int __cdecl
wstat(const wchar_t *_Filename
,struct stat
*_Stat
);
268 #ifdef _USE_32BIT_TIME_T
269 __CRT_INLINE
int __cdecl
fstat(int _Desc
,struct stat
*_Stat
) {
270 return _fstat32(_Desc
,(struct _stat32
*)_Stat
);
272 __CRT_INLINE
int __cdecl
stat(const char *_Filename
,struct stat
*_Stat
) {
273 return _stat32(_Filename
,(struct _stat32
*)_Stat
);
276 __CRT_INLINE
int __cdecl
fstat(int _Desc
,struct stat
*_Stat
) {
277 return _fstat64i32(_Desc
,(struct _stat64i32
*)_Stat
);
279 __CRT_INLINE
int __cdecl
stat(const char *_Filename
,struct stat
*_Stat
) {
280 return _stat64i32(_Filename
,(struct _stat64i32
*)_Stat
);