projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bump CI for connectivity plugin
[collectd.git]
/
src
/
perl.c
diff --git
a/src/perl.c
b/src/perl.c
index
cf30044
..
0a4ae71
100644
(file)
--- a/
src/perl.c
+++ b/
src/perl.c
@@
-33,21
+33,12
@@
/* do not automatically get the thread specific Perl interpreter */
#define PERL_NO_GET_CONTEXT
/* do not automatically get the thread specific Perl interpreter */
#define PERL_NO_GET_CONTEXT
-#define DONT_POISON_SPRINTF_YET 1
#include "collectd.h"
#include "collectd.h"
-
-#undef DONT_POISON_SPRINTF_YET
-
#include <stdbool.h>
#include <EXTERN.h>
#include <perl.h>
#include <stdbool.h>
#include <EXTERN.h>
#include <perl.h>
-#if defined(COLLECT_DEBUG) && COLLECT_DEBUG && defined(__GNUC__) && __GNUC__
-#undef sprintf
-#pragma GCC poison sprintf
-#endif
-
#include <XSUB.h>
/* Some versions of Perl define their own version of DEBUG... :-/ */
#include <XSUB.h>
/* Some versions of Perl define their own version of DEBUG... :-/ */
@@
-56,8
+47,8
@@
#endif /* DEBUG */
/* ... while we want the definition found in plugin.h. */
#endif /* DEBUG */
/* ... while we want the definition found in plugin.h. */
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include "filter_chain.h"
#include "filter_chain.h"
@@
-138,8
+129,8
@@
static int perl_flush(cdtime_t timeout, const char *identifier,
typedef struct c_ithread_s {
/* the thread's Perl interpreter */
PerlInterpreter *interp;
typedef struct c_ithread_s {
/* the thread's Perl interpreter */
PerlInterpreter *interp;
-
_B
ool running; /* thread is inside Perl interpreter */
-
_B
ool shutdown;
+
b
ool running; /* thread is inside Perl interpreter */
+
b
ool shutdown;
pthread_t pthread;
/* double linked list of threads */
pthread_t pthread;
/* double linked list of threads */
@@
-183,17
+174,17
@@
extern char **environ;
* private variables
*/
* private variables
*/
-static
_Bool register_legacy_flush = 1
;
+static
bool register_legacy_flush = true
;
/* if perl_threads != NULL perl_threads->head must
* point to the "base" thread */
/* if perl_threads != NULL perl_threads->head must
* point to the "base" thread */
-static c_ithread_list_t *perl_threads
= NULL
;
+static c_ithread_list_t *perl_threads;
/* the key used to store each pthread's ithread */
static pthread_key_t perl_thr_key;
/* the key used to store each pthread's ithread */
static pthread_key_t perl_thr_key;
-static int perl_argc
= 0
;
-static char **perl_argv
= NULL
;
+static int perl_argc;
+static char **perl_argv;
static char base_name[DATA_MAX_NAME_LEN] = "";
static char base_name[DATA_MAX_NAME_LEN] = "";
@@
-706,10
+697,8
@@
static int value_list2hv(pTHX_ value_list_t *vl, data_set_t *ds, HV *hash) {
static int notification_meta2av(pTHX_ notification_meta_t *meta, AV *array) {
int meta_num = 0;
static int notification_meta2av(pTHX_ notification_meta_t *meta, AV *array) {
int meta_num = 0;
-
- while (meta) {
+ for (notification_meta_t *m = meta; m != NULL; m = m->next) {
++meta_num;
++meta_num;
- meta = meta->next;
}
av_extend(array, meta_num);
}
av_extend(array, meta_num);
@@
-874,9
+863,9
@@
static int oconfig_item2hv(pTHX_ oconfig_item_t *ci, HV *hash) {
static char *get_module_name(char *buf, size_t buf_len, const char *module) {
int status = 0;
if (base_name[0] == '\0')
static char *get_module_name(char *buf, size_t buf_len, const char *module) {
int status = 0;
if (base_name[0] == '\0')
- status = snprintf(buf, buf_len, "%s", module);
+ status = s
s
nprintf(buf, buf_len, "%s", module);
else
else
- status = snprintf(buf, buf_len, "%s::%s", base_name, module);
+ status = s
s
nprintf(buf, buf_len, "%s::%s", base_name, module);
if ((status < 0) || ((unsigned int)status >= buf_len))
return NULL;
return buf;
if ((status < 0) || ((unsigned int)status >= buf_len))
return NULL;
return buf;
@@
-983,7
+972,7
@@
static int pplugin_dispatch_notification(pTHX_ HV *notif) {
* Call perl sub with thread locking flags handled.
*/
static int call_pv_locked(pTHX_ const char *sub_name) {
* Call perl sub with thread locking flags handled.
*/
static int call_pv_locked(pTHX_ const char *sub_name) {
-
_B
ool old_running;
+
b
ool old_running;
int ret;
c_ithread_t *t = (c_ithread_t *)pthread_getspecific(perl_thr_key);
int ret;
c_ithread_t *t = (c_ithread_t *)pthread_getspecific(perl_thr_key);
@@
-991,7
+980,7
@@
static int call_pv_locked(pTHX_ const char *sub_name) {
return 0;
old_running = t->running;
return 0;
old_running = t->running;
- t->running =
1
;
+ t->running =
true
;
if (t->shutdown) {
t->running = old_running;
if (t->shutdown) {
t->running = old_running;
@@
-1191,7
+1180,7
@@
static void c_ithread_destroy(c_ithread_t *ithread) {
/* Mark as running to avoid deadlock:
c_ithread_destroy -> log_debug -> perl_log()
*/
/* Mark as running to avoid deadlock:
c_ithread_destroy -> log_debug -> perl_log()
*/
- ithread->running =
1
;
+ ithread->running =
true
;
log_debug("Shutting down Perl interpreter %p...", aTHX);
#if COLLECT_DEBUG
log_debug("Shutting down Perl interpreter %p...", aTHX);
#if COLLECT_DEBUG
@@
-1277,8
+1266,8
@@
static c_ithread_t *c_ithread_create(PerlInterpreter *base) {
}
t->pthread = pthread_self();
}
t->pthread = pthread_self();
- t->running =
0
;
- t->shutdown =
0
;
+ t->running =
false
;
+ t->shutdown =
false
;
perl_threads->tail = t;
pthread_setspecific(perl_thr_key, (const void *)t);
perl_threads->tail = t;
pthread_setspecific(perl_thr_key, (const void *)t);
@@
-1644,23
+1633,23
@@
static void _plugin_register_generic_userdata(pTHX, int type,
*/
static XS(Collectd_plugin_register_read) {
*/
static XS(Collectd_plugin_register_read) {
-
return
_plugin_register_generic_userdata(aTHX, PLUGIN_READ, "read");
+ _plugin_register_generic_userdata(aTHX, PLUGIN_READ, "read");
}
static XS(Collectd_plugin_register_write) {
}
static XS(Collectd_plugin_register_write) {
-
return
_plugin_register_generic_userdata(aTHX, PLUGIN_WRITE, "write");
+ _plugin_register_generic_userdata(aTHX, PLUGIN_WRITE, "write");
}
static XS(Collectd_plugin_register_log) {
}
static XS(Collectd_plugin_register_log) {
-
return
_plugin_register_generic_userdata(aTHX, PLUGIN_LOG, "log");
+ _plugin_register_generic_userdata(aTHX, PLUGIN_LOG, "log");
}
static XS(Collectd_plugin_register_notification) {
}
static XS(Collectd_plugin_register_notification) {
-
return
_plugin_register_generic_userdata(aTHX, PLUGIN_NOTIF, "notification");
+ _plugin_register_generic_userdata(aTHX, PLUGIN_NOTIF, "notification");
}
static XS(Collectd_plugin_register_flush) {
}
static XS(Collectd_plugin_register_flush) {
-
return
_plugin_register_generic_userdata(aTHX, PLUGIN_FLUSH, "flush");
+ _plugin_register_generic_userdata(aTHX, PLUGIN_FLUSH, "flush");
}
typedef int perl_unregister_function_t(const char *name);
}
typedef int perl_unregister_function_t(const char *name);
@@
-1687,8
+1676,6
@@
static void _plugin_unregister_generic(pTHX, perl_unregister_function_t *unreg,
unreg(SvPV_nolen(ST(0)));
XSRETURN_EMPTY;
unreg(SvPV_nolen(ST(0)));
XSRETURN_EMPTY;
-
- return;
} /* static void _plugin_unregister_generic ( ... ) */
/*
} /* static void _plugin_unregister_generic ( ... ) */
/*
@@
-1702,24
+1689,24
@@
static void _plugin_unregister_generic(pTHX, perl_unregister_function_t *unreg,
*/
static XS(Collectd_plugin_unregister_read) {
*/
static XS(Collectd_plugin_unregister_read) {
-
return
_plugin_unregister_generic(aTHX, plugin_unregister_read, "read");
+ _plugin_unregister_generic(aTHX, plugin_unregister_read, "read");
}
static XS(Collectd_plugin_unregister_write) {
}
static XS(Collectd_plugin_unregister_write) {
-
return
_plugin_unregister_generic(aTHX, plugin_unregister_write, "write");
+ _plugin_unregister_generic(aTHX, plugin_unregister_write, "write");
}
static XS(Collectd_plugin_unregister_log) {
}
static XS(Collectd_plugin_unregister_log) {
-
return
_plugin_unregister_generic(aTHX, plugin_unregister_log, "log");
+ _plugin_unregister_generic(aTHX, plugin_unregister_log, "log");
}
static XS(Collectd_plugin_unregister_notification) {
}
static XS(Collectd_plugin_unregister_notification) {
-
return
_plugin_unregister_generic(aTHX, plugin_unregister_notification,
-
"notification");
+ _plugin_unregister_generic(aTHX, plugin_unregister_notification,
+ "notification");
}
static XS(Collectd_plugin_unregister_flush) {
}
static XS(Collectd_plugin_unregister_flush) {
-
return
_plugin_unregister_generic(aTHX, plugin_unregister_flush, "flush");
+ _plugin_unregister_generic(aTHX, plugin_unregister_flush, "flush");
}
/*
}
/*
@@
-2278,7
+2265,7
@@
static int perl_shutdown(void) {
* the thread as this will free the memory */
t = t->prev;
* the thread as this will free the memory */
t = t->prev;
- thr->shutdown =
1
;
+ thr->shutdown =
true
;
if (thr->running) {
/* Give some time to thread to exit from Perl interpreter */
WARNING("perl shutdown: Thread is running inside Perl. Waiting.");
if (thr->running) {
/* Give some time to thread to exit from Perl interpreter */
WARNING("perl shutdown: Thread is running inside Perl. Waiting.");