blob: 292d0b4a6a480e7d967e5d6e9b51fcb54f55e893 [file] [log] [blame]
niXman32ec57d2017-08-03 13:01:04 +03001/**
Pali Rohárc98e4bb2025-04-13 18:34:33 +02002 * 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.
niXman32ec57d2017-08-03 13:01:04 +03005 */
6
Pali Rohárc98e4bb2025-04-13 18:34:33 +02007#include <sys/stat.h>
niXman32ec57d2017-08-03 13:01:04 +03008
Pali Rohárc98e4bb2025-04-13 18:34:33 +02009/* When the file size does not fit into the st_size field:
10 * crtdll-msvcr90 msvcr100 msvcr110+
11 * st_size truncate 0 0
12 * errno no change no change EOVERFLOW
13 * returns 0 -1 -1
14 *
15 * This file is used only for pre-msvcr80 builds,
16 * So use the pre-msvcr80 behavior - truncate without error.
17 */
Ozkan Sezer1da96b02009-08-21 09:03:49 +000018int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32 *_Stat)
19{
20 struct _stat64 st;
Pali Rohárc98e4bb2025-04-13 18:34:33 +020021 int ret=_wstat64(_Name,&st);
22 if (ret != 0)
23 return ret;
Ozkan Sezer1da96b02009-08-21 09:03:49 +000024 _Stat->st_dev=st.st_dev;
25 _Stat->st_ino=st.st_ino;
26 _Stat->st_mode=st.st_mode;
27 _Stat->st_nlink=st.st_nlink;
28 _Stat->st_uid=st.st_uid;
29 _Stat->st_gid=st.st_gid;
30 _Stat->st_rdev=st.st_rdev;
Pali Rohárc98e4bb2025-04-13 18:34:33 +020031 _Stat->st_size=(_off_t) st.st_size; /* truncate 64-bit st_size to 32-bit */
Ozkan Sezer1da96b02009-08-21 09:03:49 +000032 _Stat->st_atime=st.st_atime;
33 _Stat->st_mtime=st.st_mtime;
34 _Stat->st_ctime=st.st_ctime;
Pali Rohárc98e4bb2025-04-13 18:34:33 +020035 return 0;
Ozkan Sezer1da96b02009-08-21 09:03:49 +000036}
Pali Rohárc98e4bb2025-04-13 18:34:33 +020037int (__cdecl *__MINGW_IMP_SYMBOL(_wstat64i32))(const wchar_t *, struct _stat64i32 *) = _wstat64i32;