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 via the _fstat64, _stat64 and _stat64 functions, which returns
both st_size and file timestamps in 64-bit precision.
Note that _fstat64, _stat64 and _stat64 functions are available in all CRT
import libraries and in pre-msvcr70 CRT import libraries are emulated too.
---
mingw-w64-crt/Makefile.am | 3 +++
mingw-w64-crt/stdio/_fstat32i64.c | 33 +++++++++++++++++++++++++++++++
mingw-w64-crt/stdio/_stat32i64.c | 33 +++++++++++++++++++++++++++++++
mingw-w64-crt/stdio/_wstat32i64.c | 33 +++++++++++++++++++++++++++++++
4 files changed, 102 insertions(+)
create mode 100644 mingw-w64-crt/stdio/_fstat32i64.c
create mode 100644 mingw-w64-crt/stdio/_stat32i64.c
create mode 100644 mingw-w64-crt/stdio/_wstat32i64.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 1f2ab82f9bc6..54e84ee62f4e 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -763,6 +763,9 @@ src_pre_msvcrt40=\
misc/_dstbias.c \
misc/dummy__setusermatherr.c \
stdio/_filelengthi64.c \
+ stdio/_fstat32i64.c \
+ stdio/_stat32i64.c \
+ stdio/_wstat32i64.c \
stdio/fgetpos.c \
stdio/fsetpos.c
diff --git a/mingw-w64-crt/stdio/_fstat32i64.c
b/mingw-w64-crt/stdio/_fstat32i64.c
new file mode 100644
index 000000000000..a30dee49d47f
--- /dev/null
+++ b/mingw-w64-crt/stdio/_fstat32i64.c
@@ -0,0 +1,33 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#define __CRT__NO_INLINE
+#include <sys/stat.h>
+
+int __cdecl _fstat32i64(int _FileDes,struct _stat32i64 *_Stat)
+{
+ struct _stat64 st;
+ int ret=_fstat64(_FileDes,&st);
+ if (ret != 0)
+ return ret;
+ _Stat->st_dev=st.st_dev;
+ _Stat->st_ino=st.st_ino;
+ _Stat->st_mode=st.st_mode;
+ _Stat->st_nlink=st.st_nlink;
+ _Stat->st_uid=st.st_uid;
+ _Stat->st_gid=st.st_gid;
+ _Stat->st_rdev=st.st_rdev;
+ _Stat->st_size=st.st_size;
+ _Stat->st_atime=(__time32_t) st.st_atime; /* truncate 64-bit st_atime to
32-bit */
+ _Stat->st_mtime=(__time32_t) st.st_mtime; /* truncate 64-bit st_mtime to
32-bit */
+ _Stat->st_ctime=(__time32_t) st.st_ctime; /* truncate 64-bit st_ctime to
32-bit */
+ return 0;
+}
+int (__cdecl *__MINGW_IMP_SYMBOL(_fstat32i64))(int, struct _stat32i64 *) =
_fstat32i64;
+
+#undef _fstati64
+int __attribute__ ((alias ("_fstat32i64"))) __cdecl _fstati64(int, struct
_stat32i64 *);
+extern int __attribute__ ((alias
(__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_fstat32i64))))) (__cdecl
*__MINGW_IMP_SYMBOL(_fstati64))(int, struct _stat32i64 *);
diff --git a/mingw-w64-crt/stdio/_stat32i64.c b/mingw-w64-crt/stdio/_stat32i64.c
new file mode 100644
index 000000000000..b83142f2a1df
--- /dev/null
+++ b/mingw-w64-crt/stdio/_stat32i64.c
@@ -0,0 +1,33 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#define __CRT__NO_INLINE
+#include <sys/stat.h>
+
+int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat)
+{
+ struct _stat64 st;
+ int ret=_stat64(_Name,&st);
+ if (ret != 0)
+ return ret;
+ _Stat->st_dev=st.st_dev;
+ _Stat->st_ino=st.st_ino;
+ _Stat->st_mode=st.st_mode;
+ _Stat->st_nlink=st.st_nlink;
+ _Stat->st_uid=st.st_uid;
+ _Stat->st_gid=st.st_gid;
+ _Stat->st_rdev=st.st_rdev;
+ _Stat->st_size=st.st_size;
+ _Stat->st_atime=(__time32_t) st.st_atime; /* truncate 64-bit st_atime to
32-bit */
+ _Stat->st_mtime=(__time32_t) st.st_mtime; /* truncate 64-bit st_mtime to
32-bit */
+ _Stat->st_ctime=(__time32_t) st.st_ctime; /* truncate 64-bit st_ctime to
32-bit */
+ return 0;
+}
+int (__cdecl *__MINGW_IMP_SYMBOL(_stat32i64))(const char *, struct _stat32i64
*) = _stat32i64;
+
+#undef _stati64
+int __attribute__ ((alias ("_stat32i64"))) __cdecl _stati64(const char *,
struct _stat32i64 *);
+extern int __attribute__ ((alias
(__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_stat32i64))))) (__cdecl
*__MINGW_IMP_SYMBOL(_stati64))(const char *, struct _stat32i64 *);
diff --git a/mingw-w64-crt/stdio/_wstat32i64.c
b/mingw-w64-crt/stdio/_wstat32i64.c
new file mode 100644
index 000000000000..a584363f0ce9
--- /dev/null
+++ b/mingw-w64-crt/stdio/_wstat32i64.c
@@ -0,0 +1,33 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+
+#define __CRT__NO_INLINE
+#include <sys/stat.h>
+
+int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64 *_Stat)
+{
+ struct _stat64 st;
+ int ret=_wstat64(_Name,&st);
+ if (ret != 0)
+ return ret;
+ _Stat->st_dev=st.st_dev;
+ _Stat->st_ino=st.st_ino;
+ _Stat->st_mode=st.st_mode;
+ _Stat->st_nlink=st.st_nlink;
+ _Stat->st_uid=st.st_uid;
+ _Stat->st_gid=st.st_gid;
+ _Stat->st_rdev=st.st_rdev;
+ _Stat->st_size=st.st_size;
+ _Stat->st_atime=(__time32_t) st.st_atime; /* truncate 64-bit st_atime to
32-bit */
+ _Stat->st_mtime=(__time32_t) st.st_mtime; /* truncate 64-bit st_mtime to
32-bit */
+ _Stat->st_ctime=(__time32_t) st.st_ctime; /* truncate 64-bit st_ctime to
32-bit */
+ return 0;
+}
+int (__cdecl *__MINGW_IMP_SYMBOL(_wstat32i64))(const wchar_t *, struct
_stat32i64 *) = _wstat32i64;
+
+#undef _wstati64
+int __attribute__ ((alias ("_wstat32i64"))) __cdecl _wstati64(const wchar_t *,
struct _stat32i64 *);
+extern int __attribute__ ((alias
(__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_wstat32i64))))) (__cdecl
*__MINGW_IMP_SYMBOL(_wstati64))(const wchar_t *, struct _stat32i64 *);
--
2.20.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public