#include "collectd.h"
-#include "common.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include <netdb.h>
#include <poll.h>
* Module global variables
*/
/* {{{ */
-static pinba_statnode_t *stat_nodes = NULL;
-static unsigned int stat_nodes_num = 0;
+static pinba_statnode_t *stat_nodes;
+static unsigned int stat_nodes_num;
static pthread_mutex_t stat_nodes_lock;
-static char *conf_node = NULL;
-static char *conf_service = NULL;
+static char *conf_node;
+static char *conf_service;
static bool collector_thread_running;
static bool collector_thread_do_shutdown;
static int pb_add_socket(pinba_socket_t *s, /* {{{ */
const struct addrinfo *ai) {
- int fd;
- int tmp;
- int status;
if (s->fd_num == PINBA_MAX_SOCKETS) {
WARNING("pinba plugin: Sorry, you have hit the built-in limit of "
return -1;
}
- fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
+ int fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
if (fd < 0) {
ERROR("pinba plugin: socket(2) failed: %s", STRERRNO);
return 0;
}
- tmp = 1;
- status = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &tmp, sizeof(tmp));
+ int status = setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int));
if (status != 0) {
WARNING("pinba plugin: setsockopt(SO_REUSEADDR) failed: %s", STRERRNO);
}