Pali Rohár | 8650898 | 2025-04-13 18:34:38 +0200 | [diff] [blame] | 1 | /** |
| 2 | * This file has no copyright assigned and is placed in the Public Domain. |
| 3 | * This file is part of the mingw-w64 runtime package. |
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package. |
| 5 | */ |
| 6 | |
| 7 | #include <sys/stat.h> |
| 8 | #include <stdlib.h> |
| 9 | |
| 10 | wchar_t *__mingw_fix_wstat_path(const wchar_t *_path); |
| 11 | |
| 12 | int __cdecl wstat64i32(const wchar_t *_Filename, struct _stat64i32 *_Stat); |
| 13 | int __cdecl wstat64i32(const wchar_t *_Filename, struct _stat64i32 *_Stat) |
| 14 | { |
| 15 | wchar_t *_path = __mingw_fix_wstat_path(_Filename); |
| 16 | int ret = _wstat64i32(_path, _Stat); |
| 17 | if (_path != _Filename) |
| 18 | free(_path); |
| 19 | return ret; |
| 20 | } |
| 21 | int (__cdecl *__MINGW_IMP_SYMBOL(wstat64i32))(const wchar_t *, struct _stat64i32 *) = wstat64i32; |
| 22 | |
| 23 | /* On 64-bit systems is wstat() function ABI compatible with wstat64i32() function */ |
| 24 | #ifdef _WIN64 |
| 25 | #undef stat |
| 26 | #undef wstat |
| 27 | struct stat; |
| 28 | int __attribute__ ((alias ("wstat64i32"))) __cdecl wstat(const wchar_t *name, struct stat *stat); |
| 29 | extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wstat64i32))))) (__cdecl *__MINGW_IMP_SYMBOL(wstat))(const wchar_t *name, struct stat *stat); |
| 30 | #endif |