This patch series is fixing stat functions as was discussed in the long
email thread "stat, _stat, and _stat64i32 issues (was: dirent changes)".
I have not included in this patch series Lasse's followup changes.
In v2 are fixed also ftw and nftw functions which directly calls stat.
And there are l
For POSIX stat compatibility, it is not possible to use msvcrt _stat32() or
_stat64i32() from crtdll.dll - msvcr100.dll CRT libraries as their
implementations do not signal EOVERFLOW error when file size does not fit
into the stat's st_size field. Signalling EOVERFLOW is required for POSIX
compatib
Functions _fstat32i64 (alias of _fstati64), _stat32i64 (alias of _stati64)
and _wstat32i64 (alias of _wstati64) are available since msvcrt40.dll.
These functions returns 64-bit st_size and 32-bit file timestamps.
For pre-msvcrt40 CRT import libraries provides mingw-w64 emulation of those
functions
There are 4 POSIX stat functions (stat32, stat32i64, stat64, stat64i32)
which differs in the stat structure point size. And there is additional
stat symbol which alias to one of those based on the _FILE_OFFSET_BITS and
_USE_32BIT_TIME_T settings.
As POSIX ftw() and nftw() functions takes also stru
All other _*stat* functions are already marked with _CRTIMP, so add it also for
missing 3 functions.
---
mingw-w64-headers/crt/sys/stat.h | 6 +++---
mingw-w64-headers/crt/wchar.h| 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mingw-w64-headers/crt/sys/stat.h b/mingw-w6
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
Currently all 32-bit non-UCRT builds are forced to use time_t type as
32-bit and also all time_t functions in 32-bit form.
With this change, any msvcrt.dll based 32-bit application can use 64-bit
time_t functions by defining -D_TIME_BITS=64 flag during compilation.
Flag -D_TIME_BITS=64 is recogni
POSIX struct stat has 4 variants in mingw-w64 based on the macros
_FILE_OFFSET_BITS and _USE_32BIT_TIME_T settings. st_size can be either
32-bit or 64-bit, and st_atime/st_mtime/st_ctime can also be 32-bit or
64-bit.
So for each ABI of struct stat there has to be separate POSIX stat function
which
Function _time64 is available since msvcr70.dll. For older msvcrt versions
provide emulation via WinAPI GetSystemTime() function which is available on
all Windows versions and returns native value in SYSTEMTIME format.
---
mingw-w64-crt/Makefile.am | 2 ++
mingw-w64-crt/lib-common/ms
Fix declaration of POSIX ftw() and nftw() functions to follow all
combinations of _FILE_OFFSET_BITS and _USE_32BIT_TIME_T settings.
Use __MINGW_ASM_CALL as a redirection to correct ABI symbol.
Do not declare these two functions when building the mingw-w64 runtime
itself as it is not clear which of
These functions are available since msvcr70.dll. For older msvcrt versions
provide emulation via _fstat32(), _stat32() and _wstat32() functions. These
functions in all pre-msvcr100 CRT libraries provides only truncated 32-bit
file size and invalid value -1 as timestamp.
The real 64-bit non-truncat
All 64-bit CRT import libraries already provides _fstat64i32, _stat64i32
and _wstat64i32 function symbols. These symbols are either directly
exported from 64-bit CRT DLL library or def file contains alias to other
ABI compatible symbols (_fstat, _stat and _wstat).
Also all these functions _fstat64
Correct versions are provided by non-inline variants. To prevent code
duplication and maintenance, remove those inline definitions completely
instead of fixing them.
---
mingw-w64-headers/crt/sys/stat.h | 84
1 file changed, 84 deletions(-)
diff --git a/mingw-w64-
On Tuesday 08 April 2025 19:23:37 Lasse Collin wrote:
> On 2025-04-06 Pali Rohár wrote:
> > On Saturday 29 March 2025 18:56:56 Lasse Collin wrote:
> > > On 2025-03-29 Pali Rohár wrote:
> > > > Problem is that you cannot define _USE_32BIT_TIME_T on UCRT
> > > > builds. There are header ifdef check
On Saturday 22 March 2025 15:35:48 Lasse Collin wrote:
> Things I noticed about your patches but I didn't make any changes:
>
> - With MSVCRT, _stat32 sets timestamps to -1 if the time doesn't fit
> into 32-bit time_t. The 32i64 wrappers truncate the timestamps
> instead. Maybe this does
15 matches
Mail list logo