#include "collectd.h"
-#include "common.h"
#include "plugin.h"
+#include "utils/common/common.h"
-#include "utils_cmd_flush.h"
-#include "utils_cmd_getthreshold.h"
-#include "utils_cmd_getval.h"
-#include "utils_cmd_listval.h"
-#include "utils_cmd_putnotif.h"
-#include "utils_cmd_putval.h"
+#include "utils/cmds/flush.h"
+#include "utils/cmds/getthreshold.h"
+#include "utils/cmds/getval.h"
+#include "utils/cmds/listval.h"
+#include "utils/cmds/putnotif.h"
+#include "utils/cmds/putval.h"
#include <sys/stat.h>
#include <sys/un.h>
"DeleteSocket"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static int loop = 0;
+static int loop;
/* socket configuration */
static int sock_fd = -1;
-static char *sock_file = NULL;
-static char *sock_group = NULL;
+static char *sock_file;
+static char *sock_group;
static int sock_perms = S_IRWXU | S_IRWXG;
-static _Bool delete_socket = 0;
+static bool delete_socket;
static pthread_t listen_thread = (pthread_t)0;
char buffer_copy[1024];
char *fields[128];
int fields_num;
- int len;
errno = 0;
if (fgets(buffer, sizeof(buffer), fhin) == NULL) {
break;
}
- len = strlen(buffer);
+ size_t len = strlen(buffer);
while ((len > 0) &&
((buffer[len - 1] == '\n') || (buffer[len - 1] == '\r')))
buffer[--len] = '\0';
sock_perms = (int)strtol(val, NULL, 8);
} else if (strcasecmp(key, "DeleteSocket") == 0) {
if (IS_TRUE(val))
- delete_socket = 1;
+ delete_socket = true;
else
- delete_socket = 0;
+ delete_socket = false;
} else {
return -1;
}
} /* int us_config */
static int us_init(void) {
- static int have_init = 0;
+ static int have_init;
int status;