summaryrefslogtreecommitdiffstats
path: root/src/libs
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-08-04 09:20:30 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-08-04 09:20:30 +0000
commitb18cf4bb8aa46248dbd32e02c9fa3ec8b9abe11e (patch)
tree40de54c0f32483b1f695673f8e1a251670d69f1a /src/libs
parentd100b7c251540bdad6c9c6214ecbf755aeb53bc7 (diff)
downloadzabbix-b18cf4bb8aa46248dbd32e02c9fa3ec8b9abe11e.tar.gz
zabbix-b18cf4bb8aa46248dbd32e02c9fa3ec8b9abe11e.tar.xz
zabbix-b18cf4bb8aa46248dbd32e02c9fa3ec8b9abe11e.zip
- added ZABBIX agent for Win64 platforms. (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3096 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/zbxcommon/comms.c8
-rwxr-xr-xsrc/libs/zbxcommon/gnuregex.c56
-rw-r--r--src/libs/zbxcommon/misc.c6
-rw-r--r--src/libs/zbxcommon/regexp.c4
-rw-r--r--src/libs/zbxcommon/str.c14
-rw-r--r--src/libs/zbxcommon/xml.c2
-rw-r--r--src/libs/zbxcrypto/base64.c4
-rw-r--r--src/libs/zbxlog/log.c36
-rwxr-xr-xsrc/libs/zbxnet/zbxsock.c18
-rwxr-xr-xsrc/libs/zbxsys/mutexs.c28
-rwxr-xr-xsrc/libs/zbxsys/threads.c18
-rw-r--r--src/libs/zbxsysinfo/common/common.c40
-rw-r--r--src/libs/zbxsysinfo/common/http.c2
-rw-r--r--src/libs/zbxsysinfo/common/system.c4
-rwxr-xr-xsrc/libs/zbxwin32/perfmon.c7
-rwxr-xr-xsrc/libs/zbxwin32/service.c17
16 files changed, 138 insertions, 126 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.");