diff options
Diffstat (limited to 'include/zbxtypes.h')
-rw-r--r-- | include/zbxtypes.h | 31 |
1 files changed, 15 insertions, 16 deletions
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 <strsafe.h> # 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 |