X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=bindings%2Fperl-shared%2FRRDs.xs;h=029b3beeebe0a3de3190e29d5e0f8419ac6c7ad3;hp=f7e5360fe536b8a9bbe4faa1a316d1b1f260285e;hb=88f9f8473259baa892d8819b7cf374c0e561103f;hpb=705c8b1988cda51a6d8d34215e3fbf3c12a9aa2a diff --git a/bindings/perl-shared/RRDs.xs b/bindings/perl-shared/RRDs.xs index f7e5360..029b3be 100644 --- a/bindings/perl-shared/RRDs.xs +++ b/bindings/perl-shared/RRDs.xs @@ -10,7 +10,25 @@ extern "C" { } #endif +/* + * rrd_tool.h includes config.h, but at least on Ubuntu Breezy Badger + * 5.10 with gcc 4.0.2, the C preprocessor picks up Perl's config.h + * which is included from the Perl includes and never reads rrdtool's + * config.h. Without including rrdtool's config.h, this module does + * not compile, so include it here with an explicit path. + * + * Because rrdtool's config.h redefines VERSION which is originally + * set via Perl's Makefile.PL and passed down to the C compiler's + * command line, save the original value and reset it after the + * includes. + */ +#define VERSION_SAVED VERSION +#undef VERSION +#include "../../rrd_config.h" #include "../../src/rrd_tool.h" +#undef VERSION +#define VERSION VERSION_SAVED +#undef VERSION_SAVED /* perl 5.004 compatibility */ #if PERLPATCHLEVEL < 5 @@ -60,8 +78,8 @@ extern "C" { free(argv); \ if (rrd_test_error()) XSRETURN_UNDEF; \ hash = newHV(); \ + save=data; \ while (data) { \ - save=data; \ /* the newSV will get copied by hv so we create it as a mortal \ to make sure it does not keep hanging round after the fact */ \ switch (data->type) { \ @@ -79,14 +97,14 @@ extern "C" { break; \ case RD_I_STR: \ hvs(newSVpv(data->value.u_str,0)); \ - rrd_freemem(data->value.u_str); \ + break; \ + case RD_I_BLO: \ + hvs(newSVpv(data->value.u_blo.ptr,data->value.u_blo.size)); \ break; \ } \ - rrd_freemem(data->key); \ data = data->next; \ - rrd_freemem(save); \ - } \ - rrd_freemem(data); \ + } \ + rrd_info_free(save); \ RETVAL = newRV_noinc((SV*)hash); /* @@ -181,7 +199,7 @@ rrd_tune(...) RETVAL -void +SV * rrd_graph(...) PROTOTYPE: @ PREINIT: @@ -227,7 +245,7 @@ rrd_graph(...) PUSHs(sv_2mortal(newSViv(xsize))); PUSHs(sv_2mortal(newSViv(ysize))); -void +SV * rrd_fetch(...) PROTOTYPE: @ PREINIT: @@ -280,25 +298,25 @@ rrd_fetch(...) PUSHs(sv_2mortal(newRV_noinc((SV*)names))); PUSHs(sv_2mortal(newRV_noinc((SV*)retar))); -void +SV * rrd_times(start, end) char *start char *end PREINIT: - struct rrd_time_value start_tv, end_tv; + rrd_time_value_t start_tv, end_tv; char *parsetime_error = NULL; time_t start_tmp, end_tmp; PPCODE: rrd_clear_error(); - if( (parsetime_error = parsetime( start, &start_tv))) { - rrd_set_error( "start time: %s", parsetime_error); + if ((parsetime_error = rrd_parsetime(start, &start_tv))) { + rrd_set_error("start time: %s", parsetime_error); XSRETURN_UNDEF; } - if( (parsetime_error = parsetime( end, &end_tv))) { - rrd_set_error( "end time: %s", parsetime_error); + if ((parsetime_error = rrd_parsetime(end, &end_tv))) { + rrd_set_error("end time: %s", parsetime_error); XSRETURN_UNDEF; } - if( proc_start_end( &start_tv, &end_tv, &start_tmp, &end_tmp) == -1) { + if (rrd_proc_start_end(&start_tv, &end_tv, &start_tmp, &end_tmp) == -1) { XSRETURN_UNDEF; } EXTEND(sp,2); @@ -367,7 +385,7 @@ SV* rrd_info(...) PROTOTYPE: @ PREINIT: - info_t *data,*save; + rrd_info_t *data,*save; int i; char **argv; HV *hash; @@ -380,7 +398,7 @@ SV* rrd_updatev(...) PROTOTYPE: @ PREINIT: - info_t *data,*save; + rrd_info_t *data,*save; int i; char **argv; HV *hash; @@ -389,6 +407,19 @@ rrd_updatev(...) OUTPUT: RETVAL +SV* +rrd_graphv(...) + PROTOTYPE: @ + PREINIT: + rrd_info_t *data,*save; + int i; + char **argv; + HV *hash; + CODE: + rrdinfocode(rrd_graph_v); + OUTPUT: + RETVAL + int rrd_dump(...) PROTOTYPE: @ @@ -413,3 +444,13 @@ rrd_restore(...) OUTPUT: RETVAL +int +rrd_flushcached(...) + PROTOTYPE: @ + PREINIT: + int i; + char **argv; + CODE: + rrdcode(rrd_flushcached); + OUTPUT: + RETVAL