From 3b74170245fd7aac5d6fd17ca0a9aecacdb446f5 Mon Sep 17 00:00:00 2001 From: Andris Zeila Date: Mon, 2 Dec 2019 09:41:34 +0200 Subject: ...G...... [ZBXNEXT-5609] added agent2 windows build support * commit '636b601d1dec2d9b3bf4d423877c0477ba7a7fe0': (39 commits) .......... [ZBXNEXT-5609] fixed coding style .......... [ZBXNEXT-5609] added changelog entry .......... [DEV-1333] fixed compilation on windows .......... [DEV-1333] removed unused function .......... [DEV-1333] fixed log monitoring crash .......... [DEV-1333] added empty scheduler update when host is disabled .......... [DEV-1333] removed mtime from eventlog result .......... [DEV-1333] fixed version remote command format .......... [DEV-1333] fixed 64 bit architecture setting .......... [DEV-1333] added compile date/time/os/arch variable support .......... [DEV-1333] fixed logrt not working on windows due to file being opened in text mode instead of binary and path separator being unix style .......... [DEV-1333] reworked windows command execution to use undocumented (but widely used) NtResumeProcess() function from ntdll.dll .......... [DEV-1333] fixed logrt on windows .......... [DEV-1333] added application starting directory as default location for agent configuration file on windows .......... [DEV-1333] added current directory as default location for agent configuration file on windows .......... [DEV-1333] added comment, minor refactoring .......... [DEV-1333] removed global system.run related configuration settings .......... [DEV-1333] fixed command execution on 32 bit windows, added check for process exit code as a workaround for race condition when started process finished before a job is assigned .......... [DEV-1333] fixed not to support PID file on Windows .......... [DEV-1333] fixed not to support PID file on Windows ... (cherry picked from commit 014f43c2a00bf7286c70cd14ecc1cddfa9254e6e) --- include/zbxtypes.h | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'include/zbxtypes.h') diff --git a/include/zbxtypes.h b/include/zbxtypes.h index 4007906c095..e51a3e0c6c8 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -23,23 +23,28 @@ #if defined(_WINDOWS) # define ZBX_THREAD_LOCAL __declspec(thread) #else -# if defined(__GNUC__) || defined(__clang__) +# if defined(__GNUC__) || defined(__clang__) || defined(__MINGW32__) # define ZBX_THREAD_LOCAL __thread # else # define ZBX_THREAD_LOCAL # endif #endif -#define ZBX_FS_DBL "%lf" -#define ZBX_FS_DBL_EXT(p) "%." #p "lf" - -#define ZBX_PTR_SIZE sizeof(void *) +#if defined(_WINDOWS) +# define zbx_open(pathname, flags) __zbx_open(pathname, flags | O_BINARY) +# define PATH_SEPARATOR '\\' +#elif defined(__MINGW32__) +# define zbx_open(pathname, flags) open(pathname, flags | O_BINARY) +# define PATH_SEPARATOR '\\' +#else +# define zbx_open(pathname, flags) open(pathname, flags) +# define PATH_SEPARATOR '/' +#endif #if defined(_WINDOWS) # include # define zbx_stat(path, buf) __zbx_stat(path, buf) -# define zbx_open(pathname, flags) __zbx_open(pathname, flags | O_BINARY) # ifndef __UINT64_C # define __UINT64_C(x) x @@ -69,19 +74,13 @@ typedef unsigned __int32 zbx_uint32_t; typedef uint32_t zbx_uint32_t; # endif -# ifndef PATH_SEPARATOR -# define PATH_SEPARATOR '\\' -# endif - # define strcasecmp lstrcmpiA typedef __int64 zbx_offset_t; # define zbx_lseek(fd, offset, whence) _lseeki64(fd, (zbx_offset_t)(offset), whence) #else /* _WINDOWS */ - # define zbx_stat(path, buf) stat(path, buf) -# define zbx_open(pathname, flags) open(pathname, flags) # ifndef __UINT64_C # ifdef UINT64_C @@ -147,15 +146,15 @@ typedef __int64 zbx_offset_t; typedef uint32_t zbx_uint32_t; -# ifndef PATH_SEPARATOR -# define PATH_SEPARATOR '/' -# endif - typedef off_t zbx_offset_t; # define zbx_lseek(fd, offset, whence) lseek(fd, (zbx_offset_t)(offset), whence) #endif /* _WINDOWS */ +#define ZBX_FS_DBL "%lf" +#define ZBX_FS_DBL_EXT(p) "%." #p "lf" + +#define ZBX_PTR_SIZE sizeof(void *) #define ZBX_FS_SIZE_T ZBX_FS_UI64 #define ZBX_FS_SSIZE_T ZBX_FS_I64 #define ZBX_FS_TIME_T ZBX_FS_I64 -- cgit v1.2.3