1 diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
2 index e83ab1a..c71d44e 100644
3 --- a/lib/sys_stat.in.h
4 +++ b/lib/sys_stat.in.h
5 @@ -500,14 +500,33 @@ extern int mknodat (int fd, char const *file, mode_t mode, dev_t dev)
6 /* We can't use the object-like #define stat rpl_stat, because of
7 struct stat. This means that rpl_stat will not be used if the user
8 does (stat)(a,b). Oh well. */
11 +# if defined _AIX && defined stat && defined _LARGE_FILES
12 /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
13 so we have to replace stat64() instead of stat(). */
16 # define stat64(name, st) rpl_stat (name, st)
17 -# else /* !_LARGE_FILES */
18 +# elif defined __MINGW32__ && defined stat
19 +# ifdef _USE_32BIT_TIME_T
20 + /* The system headers define stat to _stat32i64. */
22 +# define _stat32i64(name, st) rpl_stat (name, st)
24 + /* The system headers define stat to _stat64. */
26 +# define _stat64(name, st) rpl_stat (name, st)
28 +# elif defined _MSC_VER && defined stat
29 +# ifdef _USE_32BIT_TIME_T
30 + /* The system headers define stat to _stat32. */
32 +# define _stat32(name, st) rpl_stat (name, st)
34 + /* The system headers define stat to _stat64i32. */
36 +# define _stat64i32(name, st) rpl_stat (name, st)
38 +# else /* !(_AIX ||__MINGW32__ || _MSC_VER) */
40 # define stat(name, st) rpl_stat (name, st)
41 # endif /* !_LARGE_FILES */
42 extern int stat (const char *name, struct stat *buf) _GL_ARG_NONNULL ((1, 2));