Greetings, I am compiling the net-snmp 5.2.1 package on Cygwin under XP (sp2) and have run into errors due to winsock.h.
I used the recommended win32 configure: sh configure --with-mib-modules="host agentx disman/event-mib examples/example" --with-out-mib-modules=host/hr_network
During make, I get the following error from agent/mibgroup/host/hr_swrun.c:82:
winsock.h: error: redefinition of 'struct timeval'
and many more similar errors....
Does anyone have any suggestions on how to get past this problem? Thanks!
Please try the attached patch patch-cygwin-host_res and let me know if it solves your problem.
Are you using an older installation of Cygwin? I am using a recent version, and I also had an error regarding PID_ZOMBIE. The attached patch patch-cygwin-PID_ZOMBIE should fix that problem if you upgrade your Cygwin.
Alex
--- agent/mibgroup/host_res.h.org 2004-10-14 23:29:40.000000000 -0400 +++ agent/mibgroup/host_res.h 2005-04-26 20:35:36.000000000 -0400 @@ -21,11 +21,11 @@ #define _KERNEL 1 #define _I_DEFINED_KERNEL #endif -#ifndef WIN32 +#if defined (WIN32) && !defined (cygwin) +#include <winsock.h> +#else /* WIN32 */ #include <sys/socket.h> #include <net/if.h> -#else -#include <winsock.h> #endif /* WIN32 */ #ifdef _I_DEFINED_KERNEL #undef _KERNEL
--- agent/mibgroup/host/hr_swrun.c.org 2005-04-26 20:27:06.000000000 -0400 +++ agent/mibgroup/host/hr_swrun.c 2005-04-26 20:36:56.000000000 -0400 @@ -604,7 +604,8 @@ strcpy(string, cp); fclose(fp); #elif defined(cygwin) - if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) + /* if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) */ + if (lowproc.process_state & PID_EXITED || (lowproc.exitcode & ~0xffff)) strcpy(string, "<defunct>"); else if (lowproc.ppid) { cygwin_conv_to_posix_path(lowproc.progname, string); @@ -725,7 +726,8 @@ } fclose(fp); #elif defined(cygwin) - if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) + /* if (lowproc.process_state & (PID_ZOMBIE | PID_EXITED)) */ + if (lowproc.process_state & PID_EXITED || (lowproc.exitcode & ~0xffff)) strcpy(string, "<defunct>"); else if (lowproc.ppid) cygwin_conv_to_posix_path(lowproc.progname, string); @@ -864,7 +866,8 @@ #if defined(cygwin) if (lowproc.process_state & PID_STOPPED) long_return = 3; /* notRunnable */ - else if (lowproc.process_state & PID_ZOMBIE) + /* else if (lowproc.process_state & PID_ZOMBIE) */ + else if (lowproc.exitcode & ~0xffff) long_return = 4; /* invalid */ else long_return = 1; /* running */