diff options
Diffstat (limited to 'src')
27 files changed, 202 insertions, 186 deletions
diff --git a/src/libs/zbxcommon/comms.c b/src/libs/zbxcommon/comms.c index 9cee531a..d53457fd 100644 --- a/src/libs/zbxcommon/comms.c +++ b/src/libs/zbxcommon/comms.c @@ -35,12 +35,12 @@ int comms_create_request(char *host, char *key, char *data, char *lastlogsize, c memset(data_b64,0,sizeof(data_b64)); memset(lastlogsize_b64,0,sizeof(lastlogsize_b64)); - str_base64_encode(host, host_b64, strlen(host)); - str_base64_encode(key, key_b64, strlen(key)); - str_base64_encode(data, data_b64, strlen(data)); + str_base64_encode(host, host_b64, (int)strlen(host)); + str_base64_encode(key, key_b64, (int)strlen(key)); + str_base64_encode(data, data_b64, (int)strlen(data)); if(lastlogsize[0]!=0) { - str_base64_encode(lastlogsize, lastlogsize_b64, strlen(lastlogsize)); + str_base64_encode(lastlogsize, lastlogsize_b64, (int)strlen(lastlogsize)); } /* fprintf(stderr, "Data Base64 [%s]\n", data_b64);*/ diff --git a/src/libs/zbxcommon/gnuregex.c b/src/libs/zbxcommon/gnuregex.c index 9a438f2c..7789dd9e 100755 --- a/src/libs/zbxcommon/gnuregex.c +++ b/src/libs/zbxcommon/gnuregex.c @@ -19,6 +19,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#if defined(_WIN64) && defined(_MSC_VER) +/* NOTE: + + to compile this file for Windows AMD64 platform please + disable any optimisation of this file. + + otherwise, on any calling of _alloca function, you can get fatal error + C1001: INTERNAL COMPILER ERROR */ +# pragma optimize( "", off ) +#endif + /* AIX requires this to be the first thing in the file. */ #if defined (_AIX) && !defined (REGEX_MALLOC) #pragma alloca @@ -178,12 +189,13 @@ init_syntax_once () /* Emacs already defines alloca, sometimes. */ #ifndef alloca + /* Make alloca work the best possible way. */ #ifdef __GNUC__ #define alloca __builtin_alloca #elif HAVE_ALLOCA_H #include <alloca.h> - #elif WIN32 + #elif _WINDOWS #define alloca _alloca #elif !defined(_AIX) /* Already did AIX, up at the top. */ char *alloca (); @@ -1585,10 +1597,10 @@ regex_compile (pattern, size, syntax, bufp) group. They are all relative offsets, so that if the whole pattern moves because of realloc, they will still be valid. */ - COMPILE_STACK_TOP.begalt_offset = begalt - bufp->buffer; + COMPILE_STACK_TOP.begalt_offset = (pattern_offset_t)(begalt - bufp->buffer); COMPILE_STACK_TOP.fixup_alt_jump - = fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0; - COMPILE_STACK_TOP.laststart_offset = b - bufp->buffer; + = (pattern_offset_t)(fixup_alt_jump ? fixup_alt_jump - bufp->buffer + 1 : 0); + COMPILE_STACK_TOP.laststart_offset = (pattern_offset_t)(b - bufp->buffer); COMPILE_STACK_TOP.regnum = regnum; /* We will eventually replace the 0 with the number of @@ -1597,7 +1609,7 @@ regex_compile (pattern, size, syntax, bufp) represent in the compiled pattern. */ if (regnum <= MAX_REGNUM) { - COMPILE_STACK_TOP.inner_group_offset = b - bufp->buffer + 2; + COMPILE_STACK_TOP.inner_group_offset = (pattern_offset_t)(b - bufp->buffer + 2); BUF_PUSH_3 (start_memory, regnum, 0); } @@ -2035,7 +2047,7 @@ regex_compile (pattern, size, syntax, bufp) free (compile_stack.stack); /* We have succeeded; set the length of the buffer. */ - bufp->used = b - bufp->buffer; + bufp->used = (unsigned long)(b - bufp->buffer); #ifdef DEBUG if (debug) @@ -2824,7 +2836,7 @@ re_set_registers (bufp, regs, num_regs, starts, ends) { bufp->regs_allocated = REGS_UNALLOCATED; regs->num_regs = 0; - regs->start = regs->end = (regoff_t) 0; + regs->start = regs->end = (regoff_t*) 0; } } @@ -3198,7 +3210,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) /* We fill all the registers internally, independent of what we return, for use in backreferences. The number here includes an element for register zero. */ - unsigned num_regs = bufp->re_nsub + 1; + unsigned num_regs = (unsigned)bufp->re_nsub + 1; /* The currently active registers. */ unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG; @@ -3464,7 +3476,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) if (regs->num_regs > 0) { regs->start[0] = pos; - regs->end[0] = (MATCHING_IN_FIRST_STRING ? d - string1 + regs->end[0] = (regoff_t)(MATCHING_IN_FIRST_STRING ? d - string1 : d - string2 + size1); } @@ -3476,8 +3488,8 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) regs->start[mcnt] = regs->end[mcnt] = -1; else { - regs->start[mcnt] = POINTER_TO_OFFSET (regstart[mcnt]); - regs->end[mcnt] = POINTER_TO_OFFSET (regend[mcnt]); + regs->start[mcnt] = (regoff_t)POINTER_TO_OFFSET (regstart[mcnt]); + regs->end[mcnt] = (regoff_t)POINTER_TO_OFFSET (regend[mcnt]); } } @@ -3496,9 +3508,9 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) nfailure_points_pushed - nfailure_points_popped); DEBUG_PRINT2 ("%u registers pushed.\n", num_regs_pushed); - mcnt = d - pos - (MATCHING_IN_FIRST_STRING + mcnt = (int)(d - pos - (MATCHING_IN_FIRST_STRING ? string1 - : string2 - size1); + : string2 - size1)); DEBUG_PRINT2 ("Returning %d from re_match_2.\n", mcnt); @@ -3755,7 +3767,7 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) regstart[r] = old_regstart[r]; /* xx why this test? */ - if ((int) old_regend[r] >= (int) regstart[r]) + if (old_regend[r] >= regstart[r]) regend[r] = old_regend[r]; } } @@ -3815,12 +3827,12 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) PREFETCH (); /* How many characters left in this segment to match. */ - mcnt = dend - d; + mcnt = (int)(dend - d); /* Want how many consecutive characters we can match in one shot, so, if necessary, adjust the count. */ if (mcnt > dend2 - d2) - mcnt = dend2 - d2; + mcnt = (int)(dend2 - d2); /* Compare that many; failure if mismatch, else move past them. */ @@ -4681,7 +4693,7 @@ int re_exec (s) const char *s; { - const int len = strlen (s); + const int len = (int)strlen (s); return 0 <= re_search (&re_comp_buf, s, len, 0, len, (struct re_registers *) 0); } @@ -4811,7 +4823,7 @@ regexec (preg, string, nmatch, pmatch, eflags) int ret; struct re_registers regs; regex_t private_preg; - int len = strlen (string); + int len = (int)strlen (string); boolean want_reg_info = !preg->no_sub && nmatch > 0; private_preg = *preg; @@ -4826,7 +4838,7 @@ regexec (preg, string, nmatch, pmatch, eflags) if (want_reg_info) { - regs.num_regs = nmatch; + regs.num_regs = (unsigned)nmatch; regs.start = TALLOC (nmatch, regoff_t); regs.end = TALLOC (nmatch, regoff_t); if (regs.start == NULL || regs.end == NULL) @@ -4931,6 +4943,12 @@ regfree (preg) } #endif /* not emacs */ + +#if defined(_WIN64) && defined(_MSC_VER) +/* restore optimization options */ +# pragma optimize( "", on ) +#endif + /* Local variables: diff --git a/src/libs/zbxcommon/misc.c b/src/libs/zbxcommon/misc.c index 8d0f519a..381892f0 100644 --- a/src/libs/zbxcommon/misc.c +++ b/src/libs/zbxcommon/misc.c @@ -38,7 +38,7 @@ double zbx_time(void) { -#if defined(WIN32) +#if defined(_WINDOWS) struct _timeb current; @@ -46,7 +46,7 @@ double zbx_time(void) return (((double)current.time) + 1.0e-6 * ((double)current.millitm)); -#else /* not WIN32 */ +#else /* not _WINDOWS */ struct timeval current; @@ -54,7 +54,7 @@ double zbx_time(void) return (((double)current.tv_sec) + 1.0e-6 * ((double)current.tv_usec)); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } diff --git a/src/libs/zbxcommon/regexp.c b/src/libs/zbxcommon/regexp.c index d8cd9b1a..ffcf904e 100644 --- a/src/libs/zbxcommon/regexp.c +++ b/src/libs/zbxcommon/regexp.c @@ -19,9 +19,9 @@ #include "common.h" -#if defined(WIN32) +#if defined(_WINDOWS) # include "gnuregex.h" -#endif /* WIN32 */ +#endif /* _WINDOWS */ char *zbx_regexp_match(const char *string, const char *pattern, int *len) { diff --git a/src/libs/zbxcommon/str.c b/src/libs/zbxcommon/str.c index 471ea263..c2b3fd7b 100644 --- a/src/libs/zbxcommon/str.c +++ b/src/libs/zbxcommon/str.c @@ -115,7 +115,7 @@ int find_char(char *str,char c) { char *p; for(p = str; *p; p++) - if(*p == c) return (p - str); + if(*p == c) return (int)(p - str); return FAIL; } @@ -204,8 +204,8 @@ char *string_replace(char *str, const char *sub_str1, const char *sub_str2) const char *q; const char *r; char *t; - signed long len; - signed long diff; + long len; + long diff; unsigned long count = 0; assert(str); @@ -214,13 +214,13 @@ char *string_replace(char *str, const char *sub_str1, const char *sub_str2) return str; ++count; - len = strlen(sub_str1); + len = (long)strlen(sub_str1); /* count the number of occurances of sub_str1 */ for ( p+=len; (p=strstr(p, sub_str1)) != NULL; p+=len ) ++count; - diff = strlen(sub_str2) - len; + diff = (long)strlen(sub_str2) - len; /* allocate new memory */ if ( (new_str=(char *)malloc((size_t)(strlen(str) + count*diff)*sizeof(char))) @@ -268,7 +268,7 @@ void del_zeroes(char *s) if(strchr(s,'.')!=NULL) { - for(i=strlen(s)-1;;i--) + for(i = (int)strlen(s)-1;;i--) { if(s[i]=='0') { @@ -429,7 +429,7 @@ void rtrim_spaces(char *c) { int i,len; - len=strlen(c); + len = (int)strlen(c); for(i=len-1;i>=0;i--) { if( c[i] == ' ') diff --git a/src/libs/zbxcommon/xml.c b/src/libs/zbxcommon/xml.c index f6938dd2..4d242d76 100644 --- a/src/libs/zbxcommon/xml.c +++ b/src/libs/zbxcommon/xml.c @@ -52,7 +52,7 @@ int xml_get_data(char *xml,char *tag, char *data, int maxlen) if(ret == SUCCEED) { - len=end-(start+strlen(tag_open)); + len = (int)(end - start - strlen(tag_open)); if(len>maxlen) len=maxlen; diff --git a/src/libs/zbxcrypto/base64.c b/src/libs/zbxcrypto/base64.c index c19fc7fc..40518c3e 100644 --- a/src/libs/zbxcrypto/base64.c +++ b/src/libs/zbxcrypto/base64.c @@ -212,7 +212,7 @@ void str_base64_decode(char *p_b64str, char *p_str, int *p_out_size) * characters */ - in_size = strlen(p_b64str); + in_size = (int)strlen(p_b64str); memset(str_clean, 0, sizeof(str_clean)); *p_out_size = 0; @@ -226,7 +226,7 @@ void str_base64_decode(char *p_b64str, char *p_str, int *p_out_size) } /* Re-define in_size after clean-up */ - in_size = strlen(str_clean); + in_size = (int)strlen(str_clean); if ( 0 == in_size ) { diff --git a/src/libs/zbxlog/log.c b/src/libs/zbxlog/log.c index 730677ac..a63fba23 100644 --- a/src/libs/zbxlog/log.c +++ b/src/libs/zbxlog/log.c @@ -31,7 +31,7 @@ static int log_level = LOG_LEVEL_DEBUG; static ZBX_MUTEX log_file_access; -#if defined(WIN32) +#if defined(_WINDOWS) #include "messages.h" @@ -63,16 +63,16 @@ int zabbix_open_log(int type, int level, const char *filename) zbx_error("Loging to SYSLOG",filename); log_type = LOG_TYPE_SYSLOG; -#if defined(WIN32) +#if defined(_WINDOWS) system_log_handle = RegisterEventSource(NULL, ZABBIX_EVENT_SOURCE); -#else /* not WIN32 */ +#else /* not _WINDOWS */ openlog("zabbix_suckerd", LOG_PID, LOG_USER); setlogmask(LOG_UPTO(LOG_WARNING)); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } else if(LOG_TYPE_FILE == type) @@ -123,16 +123,16 @@ void zabbix_close_log(void) { if(LOG_TYPE_SYSLOG == log_type) { -#if defined(WIN32) +#if defined(_WINDOWS) if(system_log_handle) DeregisterEventSource(system_log_handle); -#else /* not WIN32 */ +#else /* not _WINDOWS */ closelog(); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } else if(log_type == LOG_TYPE_FILE) { @@ -163,13 +163,13 @@ void zabbix_log(int level, const char *fmt, ...) struct stat buf; char filename_old[MAX_STRING_LEN]; -#if defined(WIN32) +#if defined(_WINDOWS) WORD wType; char thread_id[20]; char *(strings[]) = {thread_id, message, NULL}; -#endif /* WIN32 */ +#endif /* _WINDOWS */ if( (level > log_level) || (LOG_LEVEL_EMPTY == level)) { @@ -235,7 +235,7 @@ void zabbix_log(int level, const char *fmt, ...) if(LOG_TYPE_SYSLOG == log_type) { -#if defined(WIN32) +#if defined(_WINDOWS) t = time(NULL); tm = localtime(&t); @@ -266,11 +266,11 @@ void zabbix_log(int level, const char *fmt, ...) strings, NULL); -#else /* not WIN32 */ +#else /* not _WINDOWS */ syslog(LOG_DEBUG,message); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } else { @@ -306,7 +306,7 @@ void zabbix_log(int level, const char *fmt, ...) char *strerror_from_system(unsigned long error) { -#if defined(WIN32) +#if defined(_WINDOWS) static char buffer[ZBX_MESSAGE_BUF_SIZE]; /* !!! Attention static !!! not thread safely - Win32*/ @@ -326,11 +326,11 @@ char *strerror_from_system(unsigned long error) return buffer; -#else /* not WIN32 */ +#else /* not _WINDOWS */ return strerror(errno); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } /* @@ -339,7 +339,7 @@ char *strerror_from_system(unsigned long error) char *strerror_from_module(unsigned long error, const char *module) { -#if defined(WIN32) +#if defined(_WINDOWS) static char buffer[ZBX_MESSAGE_BUF_SIZE]; /* !!! Attention static !!! not thread safely - Win32*/ char *strings[2]; @@ -361,10 +361,10 @@ char *strerror_from_module(unsigned long error, const char *module) return (char *)buffer; -#else /* not WIN32 */ +#else /* not _WINDOWS */ return strerror(errno); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } diff --git a/src/libs/zbxnet/zbxsock.c b/src/libs/zbxnet/zbxsock.c index bd0b81c1..adfcbc78 100755 --- a/src/libs/zbxnet/zbxsock.c +++ b/src/libs/zbxnet/zbxsock.c @@ -22,7 +22,7 @@ #include "log.h" -#if defined(WIN32) +#if defined(_WINDOWS) int zbx_sock_init(void) { WSADATA sockInfo; @@ -51,7 +51,7 @@ int zbx_sock_init(void) } #endif /* WIN 32 */ -#if !defined(WIN32) +#if !defined(_WINDOWS) static void sock_signal_handler(int sig) { @@ -66,11 +66,11 @@ static void sock_signal_handler(int sig) } } -#endif /* not WIN32 */ +#endif /* not _WINDOWS */ int zbx_sock_read(ZBX_SOCKET sock, void *buf, int buflen, int timeout) { -#if defined (WIN32) +#if defined (_WINDOWS) TIMEVAL time = {0,0}; FD_SET rdfs; @@ -98,7 +98,7 @@ int zbx_sock_read(ZBX_SOCKET sock, void *buf, int buflen, int timeout) return (int)recv(sock, buf, buflen, 0); -#else /* not WIN32 */ +#else /* not _WINDOWS */ static struct sigaction phan; int nread = 0; @@ -119,7 +119,7 @@ int zbx_sock_read(ZBX_SOCKET sock, void *buf, int buflen, int timeout) return nread; -#endif /* WIN32 */ +#endif /* _WINDOWS */ /* normal case the program will never reach this point. */ return SOCKET_ERROR; @@ -127,14 +127,14 @@ int zbx_sock_read(ZBX_SOCKET sock, void *buf, int buflen, int timeout) int zbx_sock_write(ZBX_SOCKET sock, void *buf, int buflen) { -#if defined (WIN32) +#if defined (_WINDOWS) return send(sock, buf, buflen,0); -#else /* not WIN32 */ +#else /* not _WINDOWS */ return write(sock, buf, buflen); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } diff --git a/src/libs/zbxsys/mutexs.c b/src/libs/zbxsys/mutexs.c index 06ad2cb8..1bd0119c 100755 --- a/src/libs/zbxsys/mutexs.c +++ b/src/libs/zbxsys/mutexs.c @@ -20,7 +20,7 @@ #include "common.h" #include "mutexs.h" -#if !defined(WIN32) +#if !defined(_WINDOWS) # if !defined(semun) union semun @@ -34,7 +34,7 @@ # include "cfg.h" -#endif /* not WIN32 */ +#endif /* not _WINDOWS */ #include "log.h" @@ -57,7 +57,7 @@ int zbx_mutex_create(ZBX_MUTEX *mutex, char *name) { -#if defined(WIN32) +#if defined(_WINDOWS) /* ignore "name" */ if(NULL == ((*mutex) = CreateMutex(NULL, FALSE, NULL))) @@ -66,7 +66,7 @@ int zbx_mutex_create(ZBX_MUTEX *mutex, char *name) return ZBX_MUTEX_ERROR; } -#else /* not WIN32 */ +#else /* not _WINDOWS */ key_t sem_key; int sem_id; @@ -95,7 +95,7 @@ int zbx_mutex_create(ZBX_MUTEX *mutex, char *name) *mutex = sem_id; -#endif /* WIN32 */ +#endif /* _WINDOWS */ return ZBX_MUTEX_OK; } @@ -120,7 +120,7 @@ int zbx_mutex_lock(ZBX_MUTEX *mutex) { -#if defined(WIN32) +#if defined(_WINDOWS) if(!*mutex) return ZBX_MUTEX_OK; @@ -130,7 +130,7 @@ int zbx_mutex_lock(ZBX_MUTEX *mutex) return ZBX_MUTEX_ERROR; } -#else /* not WIN32 */ +#else /* not _WINDOWS */ struct sembuf sem_lock = { 0, -1, 0 }; @@ -142,7 +142,7 @@ int zbx_mutex_lock(ZBX_MUTEX *mutex) return ZBX_MUTEX_ERROR; } -#endif /* WIN32 */ +#endif /* _WINDOWS */ return ZBX_MUTEX_OK; } @@ -167,7 +167,7 @@ int zbx_mutex_unlock(ZBX_MUTEX *mutex) { -#if defined(WIN32) +#if defined(_WINDOWS) if(!*mutex) return ZBX_MUTEX_OK; @@ -177,7 +177,7 @@ int zbx_mutex_unlock(ZBX_MUTEX *mutex) return ZBX_MUTEX_ERROR; } -#else /* not WIN32 */ +#else /* not _WINDOWS */ struct sembuf sem_unlock = { 0, 1, 0}; @@ -189,7 +189,7 @@ int zbx_mutex_unlock(ZBX_MUTEX *mutex) return ZBX_MUTEX_ERROR; } -#endif /* WIN32 */ +#endif /* _WINDOWS */ return ZBX_MUTEX_OK; } @@ -213,7 +213,7 @@ int zbx_mutex_unlock(ZBX_MUTEX *mutex) int zbx_mutex_destroy(ZBX_MUTEX *mutex) { -#if defined(WIN32) +#if defined(_WINDOWS) if(!*mutex) return ZBX_MUTEX_OK; @@ -223,13 +223,13 @@ int zbx_mutex_destroy(ZBX_MUTEX *mutex) return ZBX_MUTEX_ERROR; } -#else /* not WIN32 */ +#else /* not _WINDOWS */ if(!*mutex) return ZBX_MUTEX_OK; semctl(*mutex, 0, IPC_RMID, 0); -#endif /* WIN32 */ +#endif /* _WINDOWS */ *mutex = (ZBX_MUTEX)NULL; diff --git a/src/libs/zbxsys/threads.c b/src/libs/zbxsys/threads.c index 3ae8ca05..6501d5e1 100755 --- a/src/libs/zbxsys/threads.c +++ b/src/libs/zbxsys/threads.c @@ -44,7 +44,7 @@ ZBX_THREAD_HANDLE zbx_thread_start(ZBX_THREAD_ENTRY_POINTER(handler), void *args { ZBX_THREAD_HANDLE thread = 0; -#if defined(WIN32) +#if defined(_WINDOWS) unsigned thrdaddr; @@ -54,7 +54,7 @@ ZBX_THREAD_HANDLE zbx_thread_start(ZBX_THREAD_ENTRY_POINTER(handler), void *args thread = (ZBX_THREAD_HANDLE)(ZBX_THREAD_ERROR); } -#else /* not WIN32 */ +#else /* not _WINDOWS */ thread = fork(); @@ -73,7 +73,7 @@ ZBX_THREAD_HANDLE zbx_thread_start(ZBX_THREAD_ENTRY_POINTER(handler), void *args thread = (ZBX_THREAD_HANDLE)(ZBX_THREAD_ERROR); } -#endif /* WIN32 */ +#endif /* _WINDOWS */ return (ZBX_THREAD_HANDLE)(thread); } @@ -96,7 +96,7 @@ ZBX_THREAD_HANDLE zbx_thread_start(ZBX_THREAD_ENTRY_POINTER(handler), void *args int zbx_thread_wait(ZBX_THREAD_HANDLE thread) { -#if defined(WIN32) +#if defined(_WINDOWS) if(WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) { @@ -110,7 +110,7 @@ int zbx_thread_wait(ZBX_THREAD_HANDLE thread) return (0); } -#else /* not WIN32 */ +#else /* not _WINDOWS */ if(waitpid(thread, (int *)0, 0) <= 0) { @@ -118,21 +118,21 @@ int zbx_thread_wait(ZBX_THREAD_HANDLE thread) return (0); } -#endif /* WIN32 */ +#endif /* _WINDOWS */ return (1); } long int zbx_get_thread_id(void) { -#if defined(WIN32) +#if defined(_WINDOWS) return (long int) GetCurrentThreadId(); -#else /* not WIN32 */ +#else /* not _WINDOWS */ return (long int) getpid(); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } diff --git a/src/libs/zbxsysinfo/common/common.c b/src/libs/zbxsysinfo/common/common.c index ae6c739b..3610086d 100644 --- a/src/libs/zbxsysinfo/common/common.c +++ b/src/libs/zbxsysinfo/common/common.c @@ -339,7 +339,7 @@ void test_parameters(void) int i; AGENT_RESULT result; -#if defined(WIN32) +#if defined(_WINDOWS) #endif memset(&result, 0, sizeof(AGENT_RESULT)); @@ -449,7 +449,7 @@ int process(const char *in_command, unsigned flags, AGENT_RESULT *result) alias_expand(in_command, usr_command, MAX_STRING_LEN); - usr_command_len = strlen(usr_command); + usr_command_len = (int)strlen(usr_command); for( p=usr_command+usr_command_len-1; p>usr_command && ( *p=='\r' || *p =='\n' || *p == ' ' ); --p ); @@ -523,9 +523,9 @@ int process(const char *in_command, unsigned flags, AGENT_RESULT *result) if(commands[i].flags & CF_USEUPARAM) { printf("[%s]", param); - i = strlen(param)+2; + i = (int)strlen(param)+2; } else i = 0; - i += strlen(usr_cmd); + i += (int)strlen(usr_cmd); #define COLUMN_2_X 45 /* max of spaces count */ i = i > COLUMN_2_X ? 1 : (COLUMN_2_X - i); @@ -604,7 +604,7 @@ int VFS_FILE_MD5SUM(const char *cmd, const char *param, unsigned flags, AGENT_RE md5_init(&state); while ((nr = fread(buf, 1, (size_t)sizeof(buf), file)) > 0) { - md5_append(&state,(const md5_byte_t *)buf, nr); + md5_append(&state,(const md5_byte_t *)buf, (int)nr); } md5_finish(&state, hash); @@ -724,7 +724,7 @@ int VFS_FILE_CKSUM(const char *cmd, const char *param, unsigned flags, AGENT_RES #define COMPUTE(var, ch) (var) = (var) << 8 ^ crctab[(var) >> 24 ^ (ch)] crc = len = 0; - while ((nr = fread(buf, 1, sizeof(buf), f)) > 0) + while ((nr = (int)fread(buf, 1, sizeof(buf), f)) > 0) { for( len += nr, p = buf; nr--; ++p) { @@ -1136,7 +1136,7 @@ int OLD_VERSION(const char *cmd, const char *param, unsigned flags, AGENT_RE int EXECUTE_STR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { -#if defined(WIN32) +#if defined(_WINDOWS) STARTUPINFO si = {0}; PROCESS_INFORMATION pi = {0}; @@ -1144,11 +1144,11 @@ int EXECUTE_STR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT HANDLE hOutput; char szTempPath[MAX_PATH],szTempFile[MAX_PATH]; -#else /* not WIN32 */ +#else /* not _WINDOWS */ FILE *f; -#endif /* WIN32 */ +#endif /* _WINDOWS */ char cmd_result[MAX_STRING_LEN]; char command[MAX_STRING_LEN]; @@ -1160,7 +1160,7 @@ int EXECUTE_STR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT memset(cmd_result, 0, MAX_STRING_LEN); -#if defined(WIN32) +#if defined(_WINDOWS) /* Create temporary file to hold process output */ GetTempPath( MAX_PATH-1, szTempPath); @@ -1213,7 +1213,7 @@ int EXECUTE_STR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT cmd_result[len] = '\0'; -#else /* not WIN32 */ +#else /* not _WINDOWS */ strsncpy(command, param, sizeof(command)); if(0 == (f = popen(command,"r"))) @@ -1257,7 +1257,7 @@ int EXECUTE_STR(const char *cmd, const char *param, unsigned flags, AGENT_RESULT } } -#endif /* WIN32 */ +#endif /* _WINDOWS */ /* We got EOL only */ if(cmd_result[0] == '\n') @@ -1302,12 +1302,12 @@ int RUN_COMMAND(const char *cmd, const char *param, unsigned flags, AGENT_RESULT char command[MAX_STRING_LEN]; char flag[MAX_FLAG_LEN]; -#if defined (WIN32) +#if defined (_WINDOWS) STARTUPINFO si; PROCESS_INFORMATION pi; char full_command[MAX_STRING_LEN]; -#else /* not WIN32 */ +#else /* not _WINDOWS */ pid_t pid; #endif @@ -1362,7 +1362,7 @@ int RUN_COMMAND(const char *cmd, const char *param, unsigned flags, AGENT_RESULT zabbix_log(LOG_LEVEL_DEBUG, "Run nowait command '%s'",command); -#if defined(WIN32) +#if defined(_WINDOWS) zbx_snprintf(full_command, sizeof(full_command), "cmd /C \"%s\"", command); @@ -1386,7 +1386,7 @@ int RUN_COMMAND(const char *cmd, const char *param, unsigned flags, AGENT_RESULT } -#else /* not WIN32 */ +#else /* not _WINDOWS */ pid = fork(); /* run new thread 1 */ switch(pid) @@ -1428,7 +1428,7 @@ int RUN_COMMAND(const char *cmd, const char *param, unsigned flags, AGENT_RESULT break; } -#endif /* WIN32 */ +#endif /* _WINDOWS */ SET_UI64_RESULT(result, 1); @@ -1569,7 +1569,7 @@ static int tcp_expect(const char *hostname, short port, const char *request, con if(NULL != request) { - if(SOCKET_ERROR == zbx_sock_write(s, (void *)request, strlen(request))) + if(SOCKET_ERROR == zbx_sock_write(s, (void *)request, (int)strlen(request))) { zabbix_log( LOG_LEVEL_DEBUG, "Error during sending [%s:%u] [%s]",hostname, port, strerror_from_system(errno)); zbx_sock_close(s); @@ -1606,7 +1606,7 @@ static int tcp_expect(const char *hostname, short port, const char *request, con if(NULL != sendtoclose) { - if(SOCKET_ERROR == zbx_sock_write(s, (void *)sendtoclose, strlen(sendtoclose))) + if(SOCKET_ERROR == zbx_sock_write(s, (void *)sendtoclose, (int)strlen(sendtoclose))) { zabbix_log( LOG_LEVEL_DEBUG, "Error during close string sending [%s:%u] [%s]",hostname, port, strerror_from_system(errno)); } @@ -1765,7 +1765,7 @@ static int check_ssh(const char *hostname, short port, int *value_int) *value_int = 0; } - if(SOCKET_ERROR == zbx_sock_write(s, buf2, strlen(buf2))) + if(SOCKET_ERROR == zbx_sock_write(s, buf2, (int)strlen(buf2))) { zabbix_log( LOG_LEVEL_DEBUG, "Error during sending [%s:%u] [%s]",hostname, port, strerror_from_system(errno)); } diff --git a/src/libs/zbxsysinfo/common/http.c b/src/libs/zbxsysinfo/common/http.c index b38e6095..a2f8fe81 100644 --- a/src/libs/zbxsysinfo/common/http.c +++ b/src/libs/zbxsysinfo/common/http.c @@ -75,7 +75,7 @@ static int get_http_page(char *hostname, char *param, unsigned short port, char zbx_snprintf(request, sizeof(request), "GET /%s HTTP/1.1\nHost: %s\nConnection: close\n\n", param, hostname); - if(SOCKET_ERROR == zbx_sock_write(s, (void *)request, strlen(request))) + if(SOCKET_ERROR == zbx_sock_write(s, (void *)request, (int)strlen(request))) { zabbix_log( LOG_LEVEL_DEBUG, "get_http_page - Error during sending [%s:%u] [%s]",hostname, port, strerror_from_system(errno)); zbx_sock_close(s); diff --git a/src/libs/zbxsysinfo/common/system.c b/src/libs/zbxsysinfo/common/system.c index a6443822..4ce153cc 100644 --- a/src/libs/zbxsysinfo/common/system.c +++ b/src/libs/zbxsysinfo/common/system.c @@ -35,7 +35,7 @@ int SYSTEM_LOCALTIME(const char *cmd, const char *param, unsigned flags, AGENT_R return ret; } -#if !defined(WIN32) +#if !defined(_WINDOWS) int SYSTEM_UNAME(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { @@ -55,4 +55,4 @@ int SYSTEM_HOSTNAME(const char *cmd, const char *param, unsigned flags, AGEN return EXECUTE_STR(cmd, "hostname", flags, result); } -#endif /* not WIN32 */ +#endif /* not _WINDOWS */ diff --git a/src/libs/zbxwin32/perfmon.c b/src/libs/zbxwin32/perfmon.c index 63c066bb..24225f66 100755 --- a/src/libs/zbxwin32/perfmon.c +++ b/src/libs/zbxwin32/perfmon.c @@ -1,6 +1,6 @@ /* -** ZabbixW32 - Win32 agent for Zabbix -** Copyright (C) 2002 Victor Kirhenshtein +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -15,9 +15,6 @@ ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** $module: service.cpp -** **/ #include "common.h" diff --git a/src/libs/zbxwin32/service.c b/src/libs/zbxwin32/service.c index ec69ed02..a348f633 100755 --- a/src/libs/zbxwin32/service.c +++ b/src/libs/zbxwin32/service.c @@ -1,6 +1,6 @@ /* -** ZabbixW32 - Win32 agent for Zabbix -** Copyright (C) 2002 Victor Kirhenshtein +** ZABBIX +** Copyright (C) 2000-2005 SIA Zabbix ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by @@ -15,9 +15,6 @@ ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -** -** $module: service.cpp -** **/ #include "common.h" @@ -205,7 +202,7 @@ int ZabbixCreateService(char *path) } else { - zbx_error("Zabbix Win32 Agent service created successfully."); + zbx_error(ZABBIX_SERVICE_NAME " service created successfully."); CloseServiceHandle(service); } @@ -246,7 +243,7 @@ int ZabbixRemoveService(void) { if (DeleteService(service)) { - zbx_error(ZABBIX_EVENT_SOURCE "service deleted successfully"); + zbx_error(ZABBIX_EVENT_SOURCE " service deleted successfully"); } else { @@ -296,7 +293,7 @@ int ZabbixStartService(void) { if (StartService(service,0,NULL)) { - zbx_error("Zabbix Win32 Agent service started successfully."); + zbx_error(ZABBIX_SERVICE_NAME " service started successfully."); } else { @@ -340,7 +337,7 @@ int ZabbixStopService(void) if (ControlService(service,SERVICE_CONTROL_STOP,&status)) { - zbx_error("Zabbix Win32 Agent service stopped successfully."); + zbx_error(ZABBIX_SERVICE_NAME " service stopped successfully."); } else { @@ -382,7 +379,7 @@ static int ZabbixInstallEventSource(char *path) } RegSetValueEx(hKey,"TypesSupported",0,REG_DWORD,(BYTE *)&dwTypes,sizeof(DWORD)); - RegSetValueEx(hKey,"EventMessageFile",0,REG_EXPAND_SZ,(BYTE *)execName,strlen(execName)+1); + RegSetValueEx(hKey,"EventMessageFile",0,REG_EXPAND_SZ,(BYTE *)execName,(DWORD)strlen(execName)+1); RegCloseKey(hKey); zbx_error("Event source \"" ZABBIX_EVENT_SOURCE "\" installed successfully."); diff --git a/src/zabbix_agent/active.c b/src/zabbix_agent/active.c index 8e162511..47384be1 100644 --- a/src/zabbix_agent/active.c +++ b/src/zabbix_agent/active.c @@ -294,7 +294,7 @@ static int get_active_checks(char *server, unsigned short port, char *error, int zbx_snprintf(buf, sizeof(buf), "%s\n%s\n","ZBX_GET_ACTIVE_CHECKS", CONFIG_HOSTNAME); zabbix_log(LOG_LEVEL_DEBUG, "Sending [%s]", buf); - if(SOCKET_ERROR == zbx_sock_write(s, buf, strlen(buf))) + if(SOCKET_ERROR == zbx_sock_write(s, buf, (int)strlen(buf))) { switch (errno) { @@ -399,7 +399,7 @@ static int send_value(char *server,unsigned short port,char *host, char *key,cha zabbix_log(LOG_LEVEL_DEBUG, "XML before sending [%s]",buf); - if(SOCKET_ERROR == zbx_sock_write(s, buf, strlen(buf))) + if(SOCKET_ERROR == zbx_sock_write(s, buf, (int)strlen(buf))) { zabbix_log( LOG_LEVEL_WARNING, "Error during sending [%s:%u] [%s]",server, port, strerror_from_system(errno)); zbx_sock_close(s); @@ -448,7 +448,7 @@ static int process_active_checks(char *server, unsigned short port) init_result(&result); - now = time(NULL); + now = (int)time(NULL); for(i=0; NULL != active_metrics[i].key; i++) { @@ -515,7 +515,7 @@ static int process_active_checks(char *server, unsigned short port) } } - active_metrics[i].nextcheck = time(NULL)+active_metrics[i].refresh; + active_metrics[i].nextcheck = (int)time(NULL)+active_metrics[i].refresh; } return ret; } @@ -558,7 +558,7 @@ ZBX_THREAD_ENTRY(active_checks_thread, args) init_active_metrics(); refresh_metrics(activechk_args.host, activechk_args.port, error, MAX_STRING_LEN); - nextrefresh = time(NULL) + CONFIG_REFRESH_ACTIVE_CHECKS; + nextrefresh = (int)time(NULL) + CONFIG_REFRESH_ACTIVE_CHECKS; while(ZBX_IS_RUNNING) { @@ -578,7 +578,7 @@ ZBX_THREAD_ENTRY(active_checks_thread, args) } else { - sleeptime = nextcheck - time(NULL); + sleeptime = nextcheck - (int)time(NULL); sleeptime = MAX(sleeptime, 0); } @@ -602,7 +602,7 @@ ZBX_THREAD_ENTRY(active_checks_thread, args) if(time(NULL) >= nextrefresh) { refresh_metrics(activechk_args.host, activechk_args.port, error, MAX_STRING_LEN); - nextrefresh=time(NULL) + CONFIG_REFRESH_ACTIVE_CHECKS; + nextrefresh = (int)time(NULL) + CONFIG_REFRESH_ACTIVE_CHECKS; } } diff --git a/src/zabbix_agent/cpustat.c b/src/zabbix_agent/cpustat.c index 02ea93c2..ce000e24 100644 --- a/src/zabbix_agent/cpustat.c +++ b/src/zabbix_agent/cpustat.c @@ -22,11 +22,11 @@ #include "log.h" -#ifdef WIN32 +#ifdef _WINDOWS #include "perfmon.h" -#else /* not WIN32 */ +#else /* not _WINDOWS */ static int get_cpustat( int *now, @@ -45,7 +45,7 @@ float cpu_idle ); -#endif /* WIN32 */ +#endif /* _WINDOWS */ /****************************************************************************** @@ -69,7 +69,7 @@ int init_cpu_collector(ZBX_CPUS_STAT_DATA *pcpus) { -#ifdef WIN32 +#ifdef _WINDOWS SYSTEM_INFO sysInfo; PDH_STATUS status; @@ -135,12 +135,12 @@ int init_cpu_collector(ZBX_CPUS_STAT_DATA *pcpus) return 2; } -#else /* not WIN32 */ +#else /* not _WINDOWS */ memset(pcpus, 0, sizeof(ZBX_CPUS_STAT_DATA)); -#endif /* WIN32 */ +#endif /* _WINDOWS */ return 0; } @@ -164,7 +164,7 @@ int init_cpu_collector(ZBX_CPUS_STAT_DATA *pcpus) void close_cpu_collector(ZBX_CPUS_STAT_DATA *pcpus) { -#ifdef WIN32 +#ifdef _WINDOWS int i; @@ -189,13 +189,13 @@ void close_cpu_collector(ZBX_CPUS_STAT_DATA *pcpus) pcpus->pdh_query = NULL; } -#endif /* WIN32 */ +#endif /* _WINDOWS */ } void collect_cpustat(ZBX_CPUS_STAT_DATA *pcpus) { -#ifdef WIN32 +#ifdef _WINDOWS PDH_FMT_COUNTERVALUE value; @@ -303,7 +303,7 @@ void collect_cpustat(ZBX_CPUS_STAT_DATA *pcpus) if (pcpus->h_queue_index == MAX_CPU_HISTORY) pcpus->h_queue_index = 0; } -#else /* not WIN32 */ +#else /* not _WINDOWS */ int now = 0; float cpu_user, cpu_nice, cpu_system, cpu_idle; @@ -314,10 +314,10 @@ void collect_cpustat(ZBX_CPUS_STAT_DATA *pcpus) apply_cpustat(pcpus, now, cpu_user, cpu_system, cpu_nice, cpu_idle); -#endif /* WIN32 */ +#endif /* _WINDOWS */ } -#if !defined(WIN32) +#if !defined(_WINDOWS) static int get_cpustat(int *now,float *cpu_user,float *cpu_system,float *cpu_nice,float *cpu_idle) { @@ -475,4 +475,4 @@ static void apply_cpustat( CALC_CPU_LOAD(pcpus->system, pcpus->system15, pcpus->all, pcpus->all15); } -#endif /* not WIN32 */ +#endif /* not _WINDOWS */ diff --git a/src/zabbix_agent/cpustat.h b/src/zabbix_agent/cpustat.h index d36080b2..6a00496c 100644 --- a/src/zabbix_agent/cpustat.h +++ b/src/zabbix_agent/cpustat.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_CPUSTAT_H #define ZABBIX_CPUSTAT_H -#if defined (WIN32) +#if defined (_WINDOWS) #define MAX_CPU 16 #define MAX_CPU_HISTORY 900 /* 15 min in seconds */ @@ -57,7 +57,7 @@ } ZBX_CPUS_STAT_DATA; -#else /* not WIN32 */ +#else /* not _WINDOWS */ #define MAX_CPU_HISTORY 900 /* 15 min in seconds */ @@ -92,7 +92,7 @@ } ZBX_CPUS_STAT_DATA; -#endif /* WIN32 */ +#endif /* _WINDOWS */ int init_cpu_collector(ZBX_CPUS_STAT_DATA *pcpus); diff --git a/src/zabbix_agent/diskdevices.c b/src/zabbix_agent/diskdevices.c index e00d6e3d..14a63a42 100644 --- a/src/zabbix_agent/diskdevices.c +++ b/src/zabbix_agent/diskdevices.c @@ -29,7 +29,7 @@ void collect_stats_diskdevices(ZBX_DISKDEVICES_DATA *pdiskdevices) } -#if OFF && (!defined(WIN32) || (defined(TODO) && defined(WIN32))) +#if OFF && (!defined(_WINDOWS) || (defined(TODO) && defined(_WINDOWS))) //TODO!!! Make same as cpustat.c diff --git a/src/zabbix_agent/interfaces.c b/src/zabbix_agent/interfaces.c index 4159738c..43c6cd47 100644 --- a/src/zabbix_agent/interfaces.c +++ b/src/zabbix_agent/interfaces.c @@ -29,7 +29,7 @@ void collect_stats_interfaces(ZBX_INTERFACES_DATA *pinterfaces) } -#if OFF && (!defined(WIN32) || (defined(TODO) && defined(WIN32))) +#if OFF && (!defined(_WINDOWS) || (defined(TODO) && defined(_WINDOWS))) //TODO!!! Make same as cpustat.c diff --git a/src/zabbix_agent/listener.c b/src/zabbix_agent/listener.c index ab767ee7..0ecd25a3 100755 --- a/src/zabbix_agent/listener.c +++ b/src/zabbix_agent/listener.c @@ -59,7 +59,7 @@ static void process_listener(ZBX_SOCKET sock) return; } - /*command[ret-2] = '\0'; *//* remove '\r\n' sumbols from recived command (WIN32) !!!TODO!!! correct win32 agent !!!TODO!!! */ + /*command[ret-2] = '\0'; *//* remove '\r\n' sumbols from recived command (_WINDOWS) !!!TODO!!! correct win32 agent !!!TODO!!! */ command[ret-1] = '\0'; /* remove '\n' sumbols from recived command (LINUX) !!!TODO!!! */ zabbix_log(LOG_LEVEL_DEBUG, "Requested [%s]", command); @@ -76,7 +76,7 @@ static void process_listener(ZBX_SOCKET sock) zabbix_log(LOG_LEVEL_DEBUG, "Sending back [%s]", value); - ret = zbx_sock_write(sock, value, strlen(value)); + ret = zbx_sock_write(sock, value, (int)strlen(value)); if(ret == SOCKET_ERROR) { diff --git a/src/zabbix_agent/logfiles.c b/src/zabbix_agent/logfiles.c index df777344..11c5d92d 100644 --- a/src/zabbix_agent/logfiles.c +++ b/src/zabbix_agent/logfiles.c @@ -71,7 +71,7 @@ int process_log(char *filename,long *lastlogsize, char *value) } zbx_fclose(f); - *lastlogsize+=strlen(value); + *lastlogsize += (long)strlen(value); return 0; } diff --git a/src/zabbix_agent/stats.c b/src/zabbix_agent/stats.c index 1baace9e..883df153 100644 --- a/src/zabbix_agent/stats.c +++ b/src/zabbix_agent/stats.c @@ -67,7 +67,7 @@ ZBX_COLLECTOR_DATA *collector = NULL; void init_collector_data(void) { -#if defined (WIN32) +#if defined (_WINDOWS) collector = calloc(1, sizeof(ZBX_COLLECTOR_DATA)); @@ -78,7 +78,7 @@ void init_collector_data(void) } -#else /* not WIN32 */ +#else /* not _WINDOWS */ key_t shm_key; int shm_id; @@ -101,7 +101,7 @@ void init_collector_data(void) exit(1); } -#endif /* WIN32 */ +#endif /* _WINDOWS */ } /****************************************************************************** @@ -123,13 +123,13 @@ void init_collector_data(void) void free_collector_data(void) { -#if defined (WIN32) +#if defined (_WINDOWS) if(NULL == collector) return; free(collector); -#else /* not WIN32 */ +#else /* not _WINDOWS */ key_t shm_key; int shm_id; @@ -148,7 +148,7 @@ void free_collector_data(void) shmctl(shm_id, IPC_RMID, 0); -#endif /* WIN32 */ +#endif /* _WINDOWS */ collector = NULL; } diff --git a/src/zabbix_agent/zabbix_agentd.c b/src/zabbix_agent/zabbix_agentd.c index 607f1230..4d73ac23 100644 --- a/src/zabbix_agent/zabbix_agentd.c +++ b/src/zabbix_agent/zabbix_agentd.c @@ -49,24 +49,28 @@ char *progname = NULL; /* application TITLE */ -char title_message[] = "ZABBIX Agent" -#if defined(ZABBIX_SERVICE) - " (service)" -#elif defined(ZABBIX_DAEMON) /* ZABBIX_SERVICE */ - " (daemon)" -#endif /* ZABBIX_DAEMON */ +char title_message[] = APPLICATION_NAME +#if defined(_WIN64) + " Win64" +#elif defined(WIN32) + " Win32" +#endif /* WIN32 */ +#if defined(ZABBIX_SERVICE) + " (service)" +#elif defined(ZABBIX_DAEMON) + " (daemon)" +#endif /* ZABBIX_SERVICE */ ; /* end of application TITLE */ - /* application USAGE message */ char usage_message[] = "[-vhp]" -#if defined(WIN32) +#if defined(_WINDOWS) " [-idsx]" -#endif /* WIN32 */ +#endif /* _WINDOWS */ " [-c <file>] [-t <metric>]"; /*end of application USAGE message */ @@ -85,7 +89,7 @@ char *help_message[] = { " -t --test <metric> test specified metric and exit", /* " -u --usage <metric> test specified metric and exit", */ /* !!! TODO - print metric usage !!! */ -#if defined (WIN32) +#if defined (_WINDOWS) "", "Functions:", @@ -96,7 +100,7 @@ char *help_message[] = { " -s --start start ZABIX agent service", " -x --stop stop ZABIX agent service", -#endif /* WIN32 */ +#endif /* _WINDOWS */ 0 /* end of text */ }; @@ -117,7 +121,7 @@ static struct zbx_option longopts[] = {"print", 0, 0, 'p'}, {"test", 1, 0, 't'}, -#if defined (WIN32) +#if defined (_WINDOWS) {"install", 0, 0, 'i'}, {"uninstall", 0, 0, 'd'}, @@ -125,7 +129,7 @@ static struct zbx_option longopts[] = {"start", 0, 0, 's'}, {"stop", 0, 0, 'x'}, -#endif /* WIN32 */ +#endif /* _WINDOWS */ {0,0,0,0} }; @@ -134,9 +138,9 @@ static struct zbx_option longopts[] = static char shortopts[] = "c:hvpt:" -#if defined (WIN32) +#if defined (_WINDOWS) "idsx" -#endif /* WIN32 */ +#endif /* _WINDOWS */ ; /* end of COMMAND LINE OPTIONS*/ @@ -178,7 +182,7 @@ static int parse_commandline(int argc, char **argv) } break; -#if defined (WIN32) +#if defined (_WINDOWS) case 'i': task = ZBX_TASK_INSTALL_SERVICE; break; @@ -192,7 +196,7 @@ static int parse_commandline(int argc, char **argv) task = ZBX_TASK_STOP_SERVICE; break; -#endif /* WIN32 */ +#endif /* _WINDOWS */ default: task = ZBX_TASK_SHOW_USAGE; @@ -321,7 +325,7 @@ int MAIN_ZABBIX_ENTRY(void) void zbx_on_exit() { -#if !defined(WIN32) +#if !defined(_WINDOWS) int i = 0; @@ -336,7 +340,7 @@ void zbx_on_exit() } } -#endif /* not WIN32 */ +#endif /* not _WINDOWS */ zabbix_log(LOG_LEVEL_DEBUG, "zbx_on_exit() called."); @@ -393,7 +397,7 @@ int main(int argc, char **argv) switch(task) { -#if defined (WIN32) +#if defined (_WINDOWS) case ZBX_TASK_INSTALL_SERVICE: exit(ZabbixCreateService(argv[0])); break; @@ -406,7 +410,7 @@ int main(int argc, char **argv) case ZBX_TASK_STOP_SERVICE: exit(ZabbixStopService()); break; -#endif /* WIN32 */ +#endif /* _WINDOWS */ case ZBX_TASK_PRINT_SUPPORTED: test_parameters(); exit(SUCCEED); diff --git a/src/zabbix_agent/zbxconf.c b/src/zabbix_agent/zbxconf.c index 1a4a8d39..d8b9b8d3 100755 --- a/src/zabbix_agent/zbxconf.c +++ b/src/zabbix_agent/zbxconf.c @@ -35,11 +35,11 @@ # include "zbxplugin.h" #endif /* WITH_PLUGINS */ -#ifdef WIN32 +#ifdef _WINDOWS static char DEFAULT_CONFIG_FILE[] = "C:\\zabbix_agentd.conf"; -#else /* not WIN32 */ +#else /* not _WINDOWS */ static char DEFAULT_CONFIG_FILE[] = "/etc/zabbix/zabbix_agentd.conf"; -#endif /* WIN32 */ +#endif /* _WINDOWS */ #ifdef USE_PID_FILE static char DEFAULT_PID_FILE[] = "/tmp/zabbix_agentd.pid"; diff --git a/src/zabbix_server/server.c b/src/zabbix_server/server.c index e805e2e5..66613ce3 100644 --- a/src/zabbix_server/server.c +++ b/src/zabbix_server/server.c @@ -562,7 +562,7 @@ void zbx_on_exit() { zabbix_log(LOG_LEVEL_DEBUG, "zbx_on_exit() called."); -#if !defined(WIN32) +#if !defined(_WINDOWS) int i = 0; @@ -577,7 +577,7 @@ void zbx_on_exit() } } -#endif /* not WIN32 */ +#endif /* not _WINDOWS */ #ifdef USE_PID_FILE |