Patch for ePN (from Suse via Ethan Galstad) for Perl 5.8.0

Mathieu Masseboeuf mathieum at sports.fr
Fri Jan 31 11:53:49 CET 2003


Hi,

Thanks a lot for this, the patch worked like a charm.
I had to adapt it a bit as I'm working with the 1.0 release, not from the CVS.
You'll find my version down in the mail if others want to use it with the
current stable release.

I've also attached a nonrelated patch which I made to the SNMP nagios plugin.
This patch strips type output for the type STRING which the latest net-
snmp outputs when making snmp queries to some oids.
It's usefull for example when you want to query the oid describing swap
error flag, you can as well query the error message oid to put the info
next to the error.

The patch for embeded perl so it works with perl 5.8.0 (for nagios 1.0) :
--------------------- SNIP ---------------------
--- base/nagios.c.orig  2003-01-31 11:23:11.000000000 +0100
+++ base/nagios.c       2003-01-31 11:26:04.000000000 +0100
@@ -58,6 +58,8 @@
 #include <perl.h>
 static PerlInterpreter *my_perl;
 #include <fcntl.h>
+#undef ctime   /* don't need perl's threaded version */
+#undef printf   /* can't use perl's printf until initialized */
 
 /* include PERL xs_init code for module and C library support */
 
@@ -86,17 +88,14 @@
 #  endif
 #endif
  
-EXTERN_C void xs_init _((void));
+EXTERN_C void xs_init _((pTHX));
 
-EXTERN_C void boot_DynaLoader _((CV* cv));
+EXTERN_C void boot_DynaLoader _((pTHX_ CV* cv));
 
 EXTERN_C void
-xs_init(void)
+xs_init(pTHX)
 {
        char *file = __FILE__;
-#ifdef THREADEDPERL
-       dTHX;
-#endif
        dXSUB_SYS;
 
        /* DynaLoader is a special case */
@@ -779,9 +778,12 @@
 
                /* cleanup embedded perl */
 #ifdef EMBEDDEDPERL
-               PL_perl_destruct_level=0;
-               perl_destruct(perl);
-               perl_free(perl);
+               {
+                   dTHX;
+                   PL_perl_destruct_level=0;
+                   perl_destruct(perl);
+                   perl_free(perl);
+               }
 #endif
 
                /* log a shutdown message */
--- base/utils.c.orig   2003-01-31 11:26:17.000000000 +0100
+++ base/utils.c        2003-01-31 11:26:55.000000000 +0100
@@ -49,6 +49,11 @@
 #include <fcntl.h>
 /* In perl.h (or friends) there is a macro that defines sighandler as
Perl_sighandler, so we must #undef it so we can use our sighandler() f
unction */
 #undef sighandler
+/* and we don't need perl's reentrant versions */
+#undef localtime
+#undef getpwnam
+#undef getgrnam
+#undef strerror
 #endif
 
 char            *my_strtok_buffer=NULL;
--------------------- SNIP ---------------------

And the check_snmp plugin patch :
--------------------- SNIP ---------------------
--- plugins/check_snmp.c.orig   2002-11-16 06:06:02.000000000 +0100
+++ plugins/check_snmp.c        2003-01-31 11:47:23.000000000 +0100
@@ -299,6 +299,8 @@
                        show = strstr (response, "Gauge32: ") + 9;
                else if (strstr (response, "INTEGER: "))
                        show = strstr (response, "INTEGER: ") + 9;
+               else if (strstr (response, "STRING: "))
+                       show = strstr (response, "STRING: ") + 8;
                else
                        show = response;
                p2 = show;
--------------------- SNIP ---------------------
And the command I'm using :
# Check Swap
define command{
	command_name	check_snmp_swap
	command_line	$USER1$/check_snmp -H $HOSTADDRESS$ -l "Swap" -o UCD-SNMP-
MIB::memSwapError.0,UCD-SNMP-MIB::memSwapErrorMsg.0 -P 3 -L authNoPriv -a
MD5 -U LOGIN -A PASSWORD -c 0,
	}

--
Mathieu Masseboeuf - Directeur Technique
http://www.sports.fr - http://www.athleteline.com
Tous les sports en direct et en coutinu sur Internet.

>Dear Sir,
>
>Would you let either myself or Ethan know if the Suse patch attached 
>stops the SEGV with ePN and Perl 5.8.0 ?
>
>Thank you,
>
>Yours sincerely.
>-- 
>------------------------------------------------------------------------
>Stanley Hopcroft
>------------------------------------------------------------------------





-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com




More information about the Users mailing list