headers: Fix declaration of POSIX stat/fstat and LFS stat64/fstat64 functions
Move LFS defines of stat64/fstat64 from _mingw_stat64.h to sys/stat.h.
Move struct stat from _mingw_stat64.h to sys/stat.h.
Fix definition of POSIX struct stat to follow both _FILE_OFFSET_BITS and
_USE_32BIT_TIME_T settings.
Fix declaration of POSIX stat(), fstat() and mingw-w64 wstat() functions to
follow all combinations of _FILE_OFFSET_BITS and _USE_32BIT_TIME_T settings.
Declare fstat() as a function instead of macro. Define it as alias via
__MINGW_ASM_CALL to one of the CRT _fstat* function based on
_FILE_OFFSET_BITS and _USE_32BIT_TIME_T settings.
In the same way declare stat() and wstat() as functions. But as alias to
one of the mingw-w64 (w)stat* function. This is needed because msvcrt
_(w)stat* functions have issue with trailing slash and requires mingw-w64
wrapper for POSIX compatibility.
Additionally define struct stat64 for LFS functions stat64(), fstat64() and
mingw-w64 function wstat64(). And again declare them as a functions instead
of macro.
Keyword stat has to be declared as a function, not as a macro because it
would override effect of struct stat.
Do not declare these stat/fstat/wstat functions when building the mingw-w64
runtime itself as it is not clear which of those stat[size] / fstat[size] /
wstat[size] symbol should be used. Instead the mingw-w64 source file should
call the appropriate ABI compatible *stat[size] function with corresponding
ABI compatible struct _stat[size].
Signed-off-by: Martin Storsjö <martin@martin.st>
8 files changed