blob: 1ad9b53b45f339e078316ac72a11316b6a688a6a [file] [log] [blame]
Pali Rohár86508982025-04-13 18:34:38 +02001/**
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
10wchar_t *__mingw_fix_wstat_path(const wchar_t *_path);
11
12int __cdecl wstat64i32(const wchar_t *_Filename, struct _stat64i32 *_Stat);
13int __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}
21int (__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
27struct stat;
28int __attribute__ ((alias ("wstat64i32"))) __cdecl wstat(const wchar_t *name, struct stat *stat);
29extern int __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(wstat64i32))))) (__cdecl *__MINGW_IMP_SYMBOL(wstat))(const wchar_t *name, struct stat *stat);
30#endif