Page 1 of 1

[Nagios-devel] Patches for embedded Perl support in 2.0 tarball ..

Posted: Thu Nov 04, 2004 5:56 pm
by Guest
This is a multi-part message in MIME format...

--R+My9LyyhiUvIEro
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Dear Folks,

Please find enclosed patches against the 2.0alpha tar ball on Nagios.ORG
for the embedded Perl support.

(This tends to be a non volatile area so I hope the patches are Ok
against the CVS; otherwise I will redo them).

The intent is

1 remove support for reallocating Perl interp after user specified
number of checks

2 better support threaded Perls (make sure there is a PerlInterpreter
*my_perl in scope when the API or macros are called).

3 move the Perl version specific code - the xsinit() protos and defs
into their own headers and autogenned files (and out of utils.c)

Unfortunately not tested yet, and in any case at present can only be
properly checked against 1.x Nag and non threaded Perls (although with
Mr Jason Martins generous offer of a GenToo environment this should
improve).

I think the changes are basically packaging; the functional changes in
2.0 to this stuff (those in checks.c and p1.pl) seem to work ok in a
back patched/unthreaded production 1.2 Nag.

Feedback welcome.

Yours sincerely.

--
Stanley Hopcroft

Network specialist, IT Infrastructure
IP Australia
Ph: (02) 6283 3189 Fax: (02) 6281 1353
PO Box 200 Woden ACT 2606
http://www.ipaustralia.gov.au

--R+My9LyyhiUvIEro
Content-Type: application/patch
Content-Disposition: attachment; filename="Makefile.in.pat"
Content-Transfer-Encoding: quoted-printable

--- Makefile.in Thu Nov 4 20:34:16 2004
+++ Makefile.in.orig Thu Nov 4 20:07:13 2004
@@ -113,17 +113,12 @@
DDATAHDRS=3D
DDATADEPS=3D$(DDATALIBS)
=20
-# Embedded Perl XS init
-PERLXSI=3Dperlxsi.o
=20
-
-OBJS=3D$(BROKER_O) checks.o config.o commands.o events.o flapping.o loggin=
g.o notifications.o sehandlers.o utils.o $(PERLXSI) $(RDATALIBS) $(CDATALIB=
S) $(ODATALIBS) $(SDATALIBS) $(PDATALIBS) $(DDATALIBS) $(BASEEXTRALIBS) $(S=
NPRINTF_O)
+OBJS=3D$(BROKER_O) checks.o config.o commands.o events.o flapping.o loggin=
g.o notifications.o sehandlers.o utils.o $(RDATALIBS) $(CDATALIBS) $(ODATAL=
IBS) $(SDATALIBS) $(PDATALIBS) $(DDATALIBS) $(BASEEXTRALIBS) $(SNPRINTF_O)
OBJDEPS=3D$(ODATADEPS) $(ODATADEPS) $(RDATADEPS) $(CDATADEPS) $(SDATADEPS)=
$(PDATADEPS) $(DDATADEPS) $(BROKER_H)
=20
all: nagios nagiostats
=20
-perlxsi.c:
- perl -MExtUtils::Embed -e xsinit
=20
######## REQUIRED LIBRARIES ##########
=20

--R+My9LyyhiUvIEro
Content-Type: application/patch
Content-Disposition: attachment; filename="checks.c.pat"
Content-Transfer-Encoding: quoted-printable

--- checks.c Thu Nov 4 20:16:31 2004
+++ checks.c.orig Thu Nov 4 19:32:37 2004
@@ -34,7 +34,9 @@
/*#define DEBUG_CHECKS*/
=20
#ifdef EMBEDDEDPERL
-#include "../include/epn_nagios.h"
+#include
+#include
+#include
#endif
=20
extern char *temp_file;
@@ -71,6 +73,8 @@
=20
extern time_t program_start;
=20
+extern int max_embedded_perl_calls;
+
extern timed_event *event_list_low;
=20
extern host *host_list;
@@ -85,6 +89,7 @@
=20
#ifdef EMBEDDEDPERL
extern int use_embedded_perl;
+extern int embedded_perl_calls;
#endif
=20
=20
@@ -114,7 +119,7 @@
char fname[512];
char *args[5] =3D {"",DO_CLEAN, "", "", NULL };
int isperl;
-#ifdef aTHX
+#ifdef THREADEDPERL
dTHX;
#endif
dSP;
@@ -281,6 +286,12 @@
args[3]=3D"";
else
args[3]=3Dprocessed_command+strlen(fname)+1;
+
+ /* reinialize embedded perl if necessary */
+ if(use_embedded_perl=3D=3DTRUE && max_embedded_perl_calls>0 && embedded_=
perl_calls>max_embedded_perl_calls)
+ reinit_embedded_perl();
+
+ embedded_perl_calls++;
=20
/* call our perl interpreter to compile and optionally cache the command=
*/
if(use_embedded_perl=3D=3DTRUE)

--R+My9LyyhiUvIEro
Content-Type: application/patch
Content-Disposition: attachment; filename="config.c.pat"
Content-Transfer-Encoding: quoted-printable

--- config.c Thu Nov 4 20:16:31 2004
+++ config.c.orig Thu Nov 4 19:33:57 2004
@@ -146,6 +146,8 @@
=20
extern int date_format;
=20
+extern int max_embedded_perl_calls;
+
extern contact *contact_list;
ex

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]