diff options
author | Andris Zeila <andris.zeila@zabbix.com> | 2022-07-11 09:49:18 +0300 |
---|---|---|
committer | Andris Zeila <andris.zeila@zabbix.com> | 2022-07-11 09:52:42 +0300 |
commit | a096993fb12504de382e35f1b6779829729a60d1 (patch) | |
tree | 0221f97f735a27126a5c67c27bccb3cc9172f19f | |
parent | 15e3ecf2870e99613fa7036213dc39021d211069 (diff) |
...G...... [ZBX-20203] fixed agent2 log* item large file support on windows
Merge in ZBX/zabbix from feature/ZBX-20203-5.0 to release/5.0
* commit 'aa20e67c4e1c09a57af52b1a17ecc2c8015c99ed':
.D........ [ZBX-20203] added changelog entry
.......... [ZBX-20203] added zbx_stat, zbx_fstat, zbx_lseek implementations for agent2 (minggw)
(cherry picked from commit 3a3a94740a560d12051695d38533c61b10f6f9df)
-rw-r--r-- | ChangeLog.d/bugfix/ZBX-20203 | 1 | ||||
-rw-r--r-- | include/common.h | 2 | ||||
-rw-r--r-- | include/zbxtypes.h | 31 |
3 files changed, 24 insertions, 10 deletions
diff --git a/ChangeLog.d/bugfix/ZBX-20203 b/ChangeLog.d/bugfix/ZBX-20203 new file mode 100644 index 00000000000..74d2bb55499 --- /dev/null +++ b/ChangeLog.d/bugfix/ZBX-20203 @@ -0,0 +1 @@ +...G...... [ZBX-20203] fixed agent2 log* item large file support on windows (wiper) diff --git a/include/common.h b/include/common.h index 5173482c53d..8210a43410e 100644 --- a/include/common.h +++ b/include/common.h @@ -1367,6 +1367,8 @@ zbx_uint64_t suffix2factor(char c); typedef struct __stat64 zbx_stat_t; int __zbx_stat(const char *path, zbx_stat_t *buf); int __zbx_open(const char *pathname, int flags); +#elif defined(__MINGW32__) +typedef struct _stat64 zbx_stat_t; #else typedef struct stat zbx_stat_t; #endif /* _WINDOWS */ diff --git a/include/zbxtypes.h b/include/zbxtypes.h index e39f7602f9d..ba799ab27c0 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -52,9 +52,6 @@ #if defined(_WINDOWS) # include <strsafe.h> -# define zbx_stat(path, buf) __zbx_stat(path, buf) -# define zbx_fstat(fd, buf) _fstat64(fd, buf) - # ifndef __UINT64_C # define __UINT64_C(x) x # endif @@ -85,9 +82,6 @@ typedef uint32_t zbx_uint32_t; # define strcasecmp lstrcmpiA -typedef __int64 zbx_offset_t; -# define zbx_lseek(fd, offset, whence) _lseeki64(fd, (zbx_offset_t)(offset), whence) - # if defined(__INT_MAX__) && __INT_MAX__ == 2147483647 typedef int ssize_t; # else @@ -95,9 +89,6 @@ typedef long ssize_t; # endif #else /* _WINDOWS */ -# define zbx_stat(path, buf) stat(path, buf) -# define zbx_fstat(fd, buf) fstat(fd, buf) - # ifndef __UINT64_C # ifdef UINT64_C # define __UINT64_C(c) (UINT64_C(c)) @@ -162,10 +153,30 @@ typedef long ssize_t; typedef uint32_t zbx_uint32_t; +#endif /* _WINDOWS */ + +#if defined(_WINDOWS) +# define zbx_stat(path, buf) __zbx_stat(path, buf) +# define zbx_fstat(fd, buf) _fstat64(fd, buf) + +typedef __int64 zbx_offset_t; +# define zbx_lseek(fd, offset, whence) _lseeki64(fd, (zbx_offset_t)(offset), whence) + +#elif defined(__MINGW32__) +# define zbx_stat(path, buf) _stat64(path, buf) +# define zbx_fstat(fd, buf) _fstat64(fd, buf) + +typedef off64_t zbx_offset_t; +# define zbx_lseek(fd, offset, whence) lseek64(fd, (zbx_offset_t)(offset), whence) + +#else +# define zbx_stat(path, buf) stat(path, buf) +# define zbx_fstat(fd, buf) fstat(fd, buf) + typedef off_t zbx_offset_t; # define zbx_lseek(fd, offset, whence) lseek(fd, (zbx_offset_t)(offset), whence) -#endif /* _WINDOWS */ +#endif #define ZBX_FS_DBL "%lf" #define ZBX_FS_DBL_EXT(p) "%." #p "lf" |