char *set_plugin_instance;
char *set_type_instance;
- _Bool calc_num;
- _Bool calc_sum;
- _Bool calc_average;
- _Bool calc_min;
- _Bool calc_max;
- _Bool calc_stddev;
+ bool calc_num;
+ bool calc_sum;
+ bool calc_average;
+ bool calc_min;
+ bool calc_max;
+ bool calc_stddev;
}; /* }}} */
typedef struct aggregation_s aggregation_t;
static pthread_mutex_t agg_instance_list_lock = PTHREAD_MUTEX_INITIALIZER;
static agg_instance_t *agg_instance_list_head = NULL;
-static _Bool agg_is_regex(char const *str) /* {{{ */
+static bool agg_is_regex(char const *str) /* {{{ */
{
if (str == NULL)
return 0;
return 1;
else
return 0;
-} /* }}} _Bool agg_is_regex */
+} /* }}} bool agg_is_regex */
static void agg_destroy(aggregation_t *agg) /* {{{ */
{
agg->regex_fields |= LU_GROUP_BY_TYPE_INSTANCE;
/* Sanity checking */
- _Bool is_valid = 1;
+ bool is_valid = 1;
if (strcmp("/.*/", agg->ident.type) == 0) /* {{{ */
{
ERROR("aggregation plugin: It appears you did not specify the required "
static int agg_write(data_set_t const *ds, value_list_t const *vl, /* {{{ */
__attribute__((unused)) user_data_t *user_data) {
- _Bool created_by_aggregation = 0;
+ bool created_by_aggregation = 0;
/* Ignore values that were created by the aggregation plugin to avoid weird
* effects. */
(void)meta_data_get_boolean(vl->meta, "aggregation:created",
* Data types
*/
struct camqp_config_s {
- _Bool publish;
+ bool publish;
char *name;
char *host;
/* publish only */
uint8_t delivery_mode;
- _Bool store_rates;
+ bool store_rates;
int format;
/* publish & graphite format only */
char *prefix;
/* subscribe only */
char *exchange_type;
char *queue;
- _Bool queue_durable;
- _Bool queue_auto_delete;
+ bool queue_durable;
+ bool queue_auto_delete;
amqp_connection_state_t connection;
pthread_mutex_t lock;
static pthread_t *subscriber_threads = NULL;
static size_t subscriber_threads_num = 0;
-static _Bool subscriber_threads_running = 1;
+static bool subscriber_threads_running = 1;
#define CONF(c, f) (((c)->f != NULL) ? (c)->f : def_##f)
return ret;
} /* }}} char *camqp_bytes_cstring */
-static _Bool camqp_is_error(camqp_config_t *conf) /* {{{ */
+static bool camqp_is_error(camqp_config_t *conf) /* {{{ */
{
amqp_rpc_reply_t r;
return 0;
return 1;
-} /* }}} _Bool camqp_is_error */
+} /* }}} bool camqp_is_error */
static char *camqp_strerror(camqp_config_t *conf, /* {{{ */
char *buffer, size_t buffer_size) {
} /* }}} int config_set_string */
static int camqp_config_connection(oconfig_item_t *ci, /* {{{ */
- _Bool publish) {
+ bool publish) {
camqp_config_t *conf;
int status;
else if (strcasecmp("RoutingKey", child->key) == 0)
status = cf_util_get_string(child, &conf->routing_key);
else if ((strcasecmp("Persistent", child->key) == 0) && publish) {
- _Bool tmp = 0;
+ bool tmp = 0;
status = cf_util_get_boolean(child, &tmp);
if (tmp)
conf->delivery_mode = CAMQP_DM_PERSISTENT;
char *url;
char *user;
char *pass;
- _Bool verify_peer;
- _Bool verify_host;
+ bool verify_peer;
+ bool verify_host;
char *cacert;
char *ssl_ciphers;
char *server; /* user specific server type */
static char *conf_node = NULL;
static char *conf_service = NULL;
/* Defaults to false for backwards compatibility. */
-static _Bool conf_report_seconds = 0;
-static _Bool conf_persistent_conn = 1;
+static bool conf_report_seconds = 0;
+static bool conf_persistent_conn = 1;
static int global_sockfd = -1;
}
static int apcups_config(oconfig_item_t *ci) {
- _Bool persistent_conn_set = 0;
+ bool persistent_conn_set = 0;
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
static double config_altitude = NAN; /**< altitude */
static int config_normalize = 0; /**< normalization method */
-static _Bool configured = 0; /**< the whole plugin config status */
+static bool configured = 0; /**< the whole plugin config status */
static int i2c_bus_fd = -1; /**< I2C bus device FD */
/* Used only for MPL115. MPL3115 supports real oversampling in the device so */
/* no need for any postprocessing. */
-static _Bool avg_initialized = 0; /**< already initialized by real values */
+static bool avg_initialized = 0; /**< already initialized by real values */
typedef struct averaging_s {
long int *ring_buffer;
typedef struct temperature_list_s {
char *sensor_name; /**< sensor name/reference */
size_t num_values; /**< number of values (usually one) */
- _Bool initialized; /**< sensor already provides data */
+ bool initialized; /**< sensor already provides data */
struct temperature_list_s *next; /**< next in the list */
} temperature_list_t;
int battery_read_statefs(
void); /* defined in battery_statefs; used by StateFS backend */
-static _Bool report_percent = 0;
-static _Bool report_degraded = 0;
-static _Bool query_statefs = 0;
+static bool report_percent = 0;
+static bool report_degraded = 0;
+static bool query_statefs = 0;
static void battery_submit2(char const *plugin_instance, /* {{{ */
char const *type, char const *type_instance,
char const *plugin_instance;
char buffer[32];
gauge_t v = NAN;
- _Bool discharging = 0;
+ bool discharging = 0;
int status;
/* Ignore non-battery directories, such as AC power. */
gauge_t capacity_charged = NAN;
gauge_t capacity_full = NAN;
gauge_t capacity_design = NAN;
- _Bool charging = 0;
- _Bool is_current = 0;
+ bool charging = 0;
+ bool is_current = 0;
char const *plugin_instance;
char filename[PATH_MAX];
/* FIXME: Enabled by default for backwards compatibility. */
/* TODO: Remove time parsing code. */
-static _Bool config_parse_time = 1;
+static bool config_parse_time = 1;
static char *url = NULL;
static int global_opcodes = 1;
size_t src_len;
char *ptr = buffer;
size_t ptr_size = buffer_size;
- _Bool append_plus = 0;
- _Bool append_minus = 0;
+ bool append_plus = 0;
+ bool append_minus = 0;
if ((buffer == NULL) || (buffer_size <= strlen("Minus")) || (src == NULL))
return EINVAL;
return 0;
}
-static _Bool has_suffix(char const *str, char const *suffix) {
+static bool has_suffix(char const *str, char const *suffix) {
size_t str_len = strlen(str);
size_t suffix_len = strlen(suffix);
size_t offset;
size_t i;
char status[1024];
- _Bool ok;
+ bool ok;
/* special case for latency metrics. */
if (strcmp("filestore.example_latency", key) == 0)
static int cgroups_read(void) {
cu_mount_t *mnt_list = NULL;
- _Bool cgroup_found = 0;
+ bool cgroup_found = 0;
if (cu_mount_getlist(&mnt_list) == NULL) {
ERROR("cgroups plugin: cu_mount_getlist failed.");
#include <assert.h>
#include <errno.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static range_t range_critical_g;
static range_t range_warning_g;
static int consolitation_g = CON_NONE;
-static _Bool nan_is_error_g = 0;
+static bool nan_is_error_g = 0;
static char **match_ds_g = NULL;
static size_t match_ds_num_g = 0;
#include <errno.h>
#include <math.h>
#include <signal.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static struct sigaction sigint_action;
static struct sigaction sigterm_action;
-static _Bool loop = 1;
+static bool loop = 1;
__attribute__((noreturn)) static void exit_usage(int exit_status) /* {{{ */
{
struct cpu_state_s {
value_to_rate_state_t conv;
gauge_t rate;
- _Bool has_value;
+ bool has_value;
};
typedef struct cpu_state_s cpu_state_t;
* determine how many CPUs there were. Reset to 0 by cpu_reset(). */
static size_t global_cpu_num = 0;
-static _Bool report_by_cpu = 1;
-static _Bool report_by_state = 1;
-static _Bool report_percent = 0;
-static _Bool report_num_cpu = 0;
-static _Bool report_guest = 0;
-static _Bool subtract_guest = 1;
+static bool report_by_cpu = 1;
+static bool report_by_state = 1;
+static bool report_percent = 0;
+static bool report_num_cpu = 0;
+static bool report_guest = 0;
+static bool subtract_guest = 1;
static const char *config_keys[] = {"ReportByCpu", "ReportByState",
"ReportNumCpu", "ValuesPercentage",
char *user;
char *pass;
char *credentials;
- _Bool digest;
- _Bool verify_peer;
- _Bool verify_host;
+ bool digest;
+ bool verify_peer;
+ bool verify_host;
char *cacert;
struct curl_slist *headers;
char *post_body;
- _Bool response_time;
- _Bool response_code;
+ bool response_time;
+ bool response_code;
int timeout;
curl_stats_t *stats;
* exists for this part of the JSON structure. */
typedef struct {
cj_tree_entry_t *entry;
- _Bool in_array;
+ bool in_array;
int index;
char name[DATA_MAX_NAME_LEN];
} cj_state_t;
char *user;
char *pass;
char *credentials;
- _Bool digest;
- _Bool verify_peer;
- _Bool verify_host;
+ bool digest;
+ bool verify_peer;
+ bool verify_host;
char *cacert;
struct curl_slist *headers;
char *post_body;
char *user;
char *pass;
char *credentials;
- _Bool digest;
- _Bool verify_peer;
- _Bool verify_host;
+ bool digest;
+ bool verify_peer;
+ bool verify_host;
char *cacert;
char *post_body;
int timeout;
return 0;
} /* int init_global_variables */
-static int change_basedir(const char *orig_dir, _Bool create) {
+static int change_basedir(const char *orig_dir, bool create) {
char *dir;
size_t dirlen;
int status;
#endif /* KERNEL_LINUX */
struct cmdline_config {
- _Bool test_config;
- _Bool test_readall;
- _Bool create_basedir;
+ bool test_config;
+ bool test_readall;
+ bool create_basedir;
const char *configfile;
- _Bool daemonize;
+ bool daemonize;
};
static void read_cmdline(int argc, char **argv, struct cmdline_config *config) {
#include <limits.h>
#include <signal.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
int format_values(char *ret, size_t ret_len, /* {{{ */
const data_set_t *ds, const value_list_t *vl,
- _Bool store_rates) {
+ bool store_rates) {
size_t offset = 0;
int status;
gauge_t *rates = NULL;
format_name(ret, ret_len, (vl)->host, (vl)->plugin, (vl)->plugin_instance, \
(vl)->type, (vl)->type_instance)
int format_values(char *ret, size_t ret_len, const data_set_t *ds,
- const value_list_t *vl, _Bool store_rates);
+ const value_list_t *vl, bool store_rates);
int parse_identifier(char *str, char **ret_host, char **ret_plugin,
char **ret_plugin_instance, char **ret_type,
typedef struct cf_global_option_s {
const char *key;
char *value;
- _Bool from_cli; /* value set from CLI */
+ bool from_cli; /* value set from CLI */
const char *def;
} cf_global_option_t;
static int dispatch_loadplugin(oconfig_item_t *ci) {
const char *name;
- _Bool global = 0;
+ bool global = 0;
plugin_ctx_t ctx = {0};
plugin_ctx_t old_ctx;
int ret_val;
/*
* Public functions
*/
-int global_option_set(const char *option, const char *value, _Bool from_cli) {
+int global_option_set(const char *option, const char *value, bool from_cli) {
int i;
DEBUG("option = %s; value = %s;", option, value);
return 0;
} /* }}} int cf_util_get_double */
-int cf_util_get_boolean(const oconfig_item_t *ci, _Bool *ret_bool) /* {{{ */
+int cf_util_get_boolean(const oconfig_item_t *ci, bool *ret_bool) /* {{{ */
{
if ((ci == NULL) || (ret_bool == NULL))
return EINVAL;
int cf_util_get_flag(const oconfig_item_t *ci, /* {{{ */
unsigned int *ret_value, unsigned int flag) {
int status;
- _Bool b;
+ bool b;
if (ret_value == NULL)
return EINVAL;
*/
int cf_read(const char *filename);
-int global_option_set(const char *option, const char *value, _Bool from_cli);
+int global_option_set(const char *option, const char *value, bool from_cli);
const char *global_option_get(const char *option);
long global_option_get_long(const char *option, long default_value);
/* Assures the config option is a boolean and assignes it to `ret_bool'.
* Otherwise, `ret_bool' is not changed and non-zero is returned. */
-int cf_util_get_boolean(const oconfig_item_t *ci, _Bool *ret_bool);
+int cf_util_get_boolean(const oconfig_item_t *ci, bool *ret_bool);
/* Assures the config option is a boolean and set or unset the given flag in
* `ret_value' as appropriate. Returns non-zero on error. */
int64_t mv_signed_int;
uint64_t mv_unsigned_int;
double mv_double;
- _Bool mv_boolean;
+ bool mv_boolean;
};
typedef union meta_value_u meta_value_t;
} /* }}} int meta_data_add_double */
int meta_data_add_boolean(meta_data_t *md, /* {{{ */
- const char *key, _Bool value) {
+ const char *key, bool value) {
meta_entry_t *e;
if ((md == NULL) || (key == NULL))
} /* }}} int meta_data_get_double */
int meta_data_get_boolean(meta_data_t *md, /* {{{ */
- const char *key, _Bool *value) {
+ const char *key, bool *value) {
meta_entry_t *e;
if ((md == NULL) || (key == NULL) || (value == NULL))
int meta_data_add_unsigned_int(meta_data_t *md, const char *key,
uint64_t value);
int meta_data_add_double(meta_data_t *md, const char *key, double value);
-int meta_data_add_boolean(meta_data_t *md, const char *key, _Bool value);
+int meta_data_add_boolean(meta_data_t *md, const char *key, bool value);
int meta_data_get_string(meta_data_t *md, const char *key, char **value);
int meta_data_get_signed_int(meta_data_t *md, const char *key, int64_t *value);
int meta_data_get_unsigned_int(meta_data_t *md, const char *key,
uint64_t *value);
int meta_data_get_double(meta_data_t *md, const char *key, double *value);
-int meta_data_get_boolean(meta_data_t *md, const char *key, _Bool *value);
+int meta_data_get_boolean(meta_data_t *md, const char *key, bool *value);
/* Returns the value as a string, regardless of the type. */
int meta_data_as_string(meta_data_t *md, const char *key, char **value);
int64_t si;
uint64_t ui;
double d;
- _Bool b;
+ bool b;
CHECK_NOT_NULL(m = meta_data_create());
static write_queue_t *write_queue_head;
static write_queue_t *write_queue_tail;
static long write_queue_length = 0;
-static _Bool write_loop = 1;
+static bool write_loop = 1;
static pthread_mutex_t write_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t write_cond = PTHREAD_COND_INITIALIZER;
static pthread_t *write_threads = NULL;
static size_t write_threads_num = 0;
static pthread_key_t plugin_ctx_key;
-static _Bool plugin_ctx_key_initialized = 0;
+static bool plugin_ctx_key_initialized = 0;
static long write_limit_high = 0;
static long write_limit_low = 0;
static derive_t stats_values_dropped = 0;
-static _Bool record_statistics = 0;
+static bool record_statistics = 0;
/*
* Static functions
/* plugin_load_file loads the shared object "file" and calls its
* "module_register" function. Returns zero on success, non-zero otherwise. */
-static int plugin_load_file(char const *file, _Bool global) {
+static int plugin_load_file(char const *file, bool global) {
int flags = RTLD_NOW;
if (global)
flags |= RTLD_GLOBAL;
ERROR("plugin_set_dir: strdup(\"%s\") failed", dir);
}
-static _Bool plugin_is_loaded(char const *name) {
+static bool plugin_is_loaded(char const *name) {
int status;
if (plugins_loaded == NULL)
}
#define BUFSIZE 512
-int plugin_load(char const *plugin_name, _Bool global) {
+int plugin_load(char const *plugin_name, bool global) {
DIR *dh;
const char *dir;
char filename[BUFSIZE] = "";
int status;
static c_complain_t no_write_complaint = C_COMPLAIN_INIT_STATIC;
- _Bool free_meta_data = 0;
+ bool free_meta_data = 0;
assert(vl != NULL);
return (double)pos / (double)size;
} /* }}} double get_drop_probability */
-static _Bool check_drop_value(void) /* {{{ */
+static bool check_drop_value(void) /* {{{ */
{
static cdtime_t last_message_time = 0;
static pthread_mutex_t last_message_lock = PTHREAD_MUTEX_INITIALIZER;
return 1;
else
return 0;
-} /* }}} _Bool check_drop_value */
+} /* }}} bool check_drop_value */
int plugin_dispatch_values(value_list_t const *vl) {
int status;
__attribute__((sentinel)) int
plugin_dispatch_multivalue(value_list_t const *template, /* {{{ */
- _Bool store_percentage, int store_type, ...) {
+ bool store_percentage, int store_type, ...) {
value_list_t *vl;
int failed = 0;
gauge_t sum = 0.0;
break;
}
case NM_TYPE_BOOLEAN: {
- meta->nm_value.nm_boolean = *((_Bool *)value);
+ meta->nm_value.nm_boolean = *((bool *)value);
break;
}
default: {
}
int plugin_notification_meta_add_boolean(notification_t *n, const char *name,
- _Bool value) {
+ bool value) {
return plugin_notification_meta_add(n, name, NM_TYPE_BOOLEAN, &value);
}
int64_t nm_signed_int;
uint64_t nm_unsigned_int;
double nm_double;
- _Bool nm_boolean;
+ bool nm_boolean;
} nm_value;
struct notification_meta_s *next;
} notification_meta_t;
* Re-loading an already loaded module is detected and zero is returned in
* this case.
*/
-int plugin_load(const char *name, _Bool global);
+int plugin_load(const char *name, bool global);
int plugin_init_all(void);
void plugin_read_all(void);
* The number of values it failed to dispatch (zero on success).
*/
__attribute__((sentinel)) int plugin_dispatch_multivalue(value_list_t const *vl,
- _Bool store_percentage,
+ bool store_percentage,
int store_type, ...);
int plugin_dispatch_missing(const value_list_t *vl);
int plugin_notification_meta_add_double(notification_t *n, const char *name,
double value);
int plugin_notification_meta_add_boolean(notification_t *n, const char *name,
- _Bool value);
+ bool value);
int plugin_notification_meta_copy(notification_t *dst,
const notification_t *src);
void plugin_set_dir(const char *dir) { /* nop */
}
-int plugin_load(const char *name, _Bool global) { return ENOTSUP; }
+int plugin_load(const char *name, bool global) { return ENOTSUP; }
int plugin_register_config(const char *name,
int (*callback)(const char *key, const char *val),
const value_list_t *vl, const char *key, double value)
UC_WRAP(meta_data_add_double) int uc_meta_data_add_boolean(
const value_list_t *vl, const char *key,
- _Bool value) UC_WRAP(meta_data_add_boolean)
+ bool value) UC_WRAP(meta_data_add_boolean)
int uc_meta_data_get_string(const value_list_t *vl,
const char *key,
const char *key, double *value)
UC_WRAP(meta_data_get_double) int uc_meta_data_get_boolean(
const value_list_t *vl,
- const char *key, _Bool *value)
+ const char *key, bool *value)
UC_WRAP(meta_data_get_boolean)
#undef UC_WRAP
int uc_meta_data_add_double(const value_list_t *vl, const char *key,
double value);
int uc_meta_data_add_boolean(const value_list_t *vl, const char *key,
- _Bool value);
+ bool value);
int uc_meta_data_get_string(const value_list_t *vl, const char *key,
char **value);
int uc_meta_data_get_double(const value_list_t *vl, const char *key,
double *value);
int uc_meta_data_get_boolean(const value_list_t *vl, const char *key,
- _Bool *value);
+ bool *value);
#endif /* !UTILS_CACHE_H */
* 0 indicates that the complaint is no longer valid. */
cdtime_t interval;
- _Bool complained_once;
+ bool complained_once;
} c_complain_t;
#define C_COMPLAIN_INIT_STATIC \
#include <pthread.h>
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-static _Bool have_seed = 0;
+static bool have_seed = 0;
static unsigned short seed[3];
static void cdrand_seed(void) {
} /* }}} int format_zone */
int format_rfc3339(char *buffer, size_t buffer_size, struct tm const *t_tm,
- long nsec, _Bool print_nano, char const *zone) /* {{{ */
+ long nsec, bool print_nano, char const *zone) /* {{{ */
{
int len;
char *pos = buffer;
} /* }}} int format_rfc3339 */
int format_rfc3339_utc(char *buffer, size_t buffer_size, cdtime_t t,
- _Bool print_nano) /* {{{ */
+ bool print_nano) /* {{{ */
{
struct tm t_tm;
long nsec = 0;
} /* }}} int format_rfc3339_utc */
int format_rfc3339_local(char *buffer, size_t buffer_size, cdtime_t t,
- _Bool print_nano) /* {{{ */
+ bool print_nano) /* {{{ */
{
struct tm t_tm;
long nsec = 0;
char *string;
int numeric;
} value;
- _Bool is_numeric;
+ bool is_numeric;
};
typedef struct cdbi_driver_option_s cdbi_driver_option_t; /* }}} */
static ignorelist_t *il_mountpoint = NULL;
static ignorelist_t *il_fstype = NULL;
-static _Bool by_device = 0;
-static _Bool report_inodes = 0;
-static _Bool values_absolute = 1;
-static _Bool values_percentage = 0;
+static bool by_device = 0;
+static bool report_inodes = 0;
+static bool values_absolute = 1;
+static bool values_percentage = 0;
static int df_init(void) {
if (il_device == NULL)
static mach_port_t io_master_port = MACH_PORT_NULL;
/* This defaults to false for backwards compatibility. Please fix in the next
* major version. */
-static _Bool use_bsd_name = 0;
+static bool use_bsd_name = 0;
/* #endif HAVE_IOKIT_IOKITLIB_H */
#elif KERNEL_LINUX
derive_t avg_read_time;
derive_t avg_write_time;
- _Bool has_merged;
- _Bool has_in_progress;
- _Bool has_io_time;
+ bool has_merged;
+ bool has_in_progress;
+ bool has_io_time;
struct diskstats *next;
} diskstats_t;
typedef struct dpdk_link_status_config_s {
int enabled;
- _Bool send_updated;
+ bool send_updated;
uint32_t enabled_port_mask;
char port_name[RTE_MAX_ETHPORTS][DATA_MAX_NAME_LEN];
- _Bool notify;
+ bool notify;
} dpdk_link_status_config_t;
typedef struct dpdk_keep_alive_config_s {
int enabled;
- _Bool send_updated;
+ bool send_updated;
uint128_t lcore_mask;
dpdk_keepalive_shm_t *shm;
char shm_name[DATA_MAX_NAME_LEN];
- _Bool notify;
+ bool notify;
int fd;
} dpdk_keep_alive_config_t;
static c_avl_tree_t *value_map = NULL;
-static _Bool collect_mapped_only = 0;
+static bool collect_mapped_only = 0;
static int ethstat_add_interface(const oconfig_item_t *ci) /* {{{ */
{
static const char *config_keys[] = {"ValuesAbsolute", "ValuesPercentage"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static _Bool values_absolute = 1;
-static _Bool values_percentage = 0;
+static bool values_absolute = 1;
+static bool values_percentage = 0;
static int fhcount_config(const char *key, const char *value) {
int ret = -1;
}
pkcp.cert_chain = read_file(cert);
} else if (!strcasecmp("VerifyPeer", child->key)) {
- _Bool verify = 0;
+ bool verify = 0;
if (cf_util_get_boolean(child, &verify)) {
return -1;
}
static const char g_plugin_name[] = "hugepages";
-static _Bool g_flag_rpt_numa = 1;
-static _Bool g_flag_rpt_mm = 1;
+static bool g_flag_rpt_numa = 1;
+static bool g_flag_rpt_mm = 1;
-static _Bool g_values_pages = 1;
-static _Bool g_values_bytes = 0;
-static _Bool g_values_percent = 0;
+static bool g_values_pages = 1;
+static bool g_values_bytes = 0;
+static bool g_values_percent = 0;
#define HP_HAVE_NR 0x01
#define HP_HAVE_SURPLUS 0x02
typedef struct event_info event_info_t;
struct intel_pmu_ctx_s {
- _Bool hw_cache_events;
- _Bool kernel_pmu_events;
- _Bool sw_events;
+ bool hw_cache_events;
+ bool kernel_pmu_events;
+ bool sw_events;
char event_list_fn[PATH_MAX];
char **hw_events;
size_t hw_events_count;
static ignorelist_t *ignorelist = NULL;
-static _Bool report_inactive = 1;
+static bool report_inactive = 1;
#ifdef HAVE_LIBKSTAT
#if HAVE_KSTAT_H
extern kstat_ctl_t *kc;
static kstat_t *ksp[MAX_NUMIF];
static int numif = 0;
-static _Bool unique_name = 0;
+static bool unique_name = 0;
#endif /* HAVE_LIBKSTAT */
static int interface_config(const char *key, const char *value) {
struct c_ipmi_instance_s {
char *name;
ignorelist_t *ignorelist;
- _Bool notify_add;
- _Bool notify_remove;
- _Bool notify_notpresent;
- _Bool notify_conn;
- _Bool sel_enabled;
- _Bool sel_clear_event;
+ bool notify_add;
+ bool notify_remove;
+ bool notify_notpresent;
+ bool notify_conn;
+ bool sel_enabled;
+ bool sel_clear_event;
char *host;
char *connaddr;
char *password;
unsigned int authtype;
- _Bool connected;
+ bool connected;
ipmi_con_t *connection;
pthread_mutex_t sensor_list_lock;
c_ipmi_sensor_list_t *sensor_list;
- _Bool active;
+ bool active;
pthread_t thread_id;
int init_in_progress;
if (strcasecmp("Sensor", child->key) == 0)
ignorelist_add(st->ignorelist, child->values[0].value.string);
else if (strcasecmp("IgnoreSelected", child->key) == 0) {
- _Bool t;
+ bool t;
status = cf_util_get_boolean(child, &t);
if (status != 0)
break;
} /* int c_ipmi_config_add_instance */
static int c_ipmi_config(oconfig_item_t *ci) {
- _Bool have_instance_block = 0;
+ bool have_instance_block = 0;
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
#include <assert.h>
#include <errno.h>
#include <math.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
/*
* Private functions
*/
-static _Bool have_gcrypt(void) /* {{{ */
+static bool have_gcrypt(void) /* {{{ */
{
- static _Bool result = 0;
- static _Bool need_init = 1;
+ static bool result = 0;
+ static bool need_init = 1;
if (!need_init)
return result;
#else
return 0;
#endif
-} /* }}} _Bool have_gcrypt */
+} /* }}} bool have_gcrypt */
#ifndef HAVE_HTONLL
static uint64_t htonll(uint64_t val) /* {{{ */
#include <errno.h>
#include <math.h>
#include <pthread.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "collectd/server.h"
#include <errno.h>
+#include <stdbool.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <stdio.h>
#define DEBUG(...) printf(__VA_ARGS__)
-static _Bool is_multicast(struct addrinfo const *ai) {
+static bool is_multicast(struct addrinfo const *ai) {
if (ai->ai_family == AF_INET) {
struct sockaddr_in *addr = (struct sockaddr_in *)ai->ai_addr;
return IN_MULTICAST(ntohl(addr->sin_addr.s_addr));
}
int lcc_listen_and_write(lcc_listener_t srv) {
- _Bool close_socket = 0;
+ bool close_socket = 0;
if (srv.conn < 0) {
int status = server_open(&srv);
#include <sys/protosw.h>
#endif /* HAVE_PERFSTAT */
-static _Bool report_relative_load = 0;
+static bool report_relative_load = 0;
static const char *config_keys[] = {"ReportRelative"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static void log_logstash_print(yajl_gen g, int severity,
cdtime_t timestamp_time) {
FILE *fh;
- _Bool do_close = 0;
+ bool do_close = 0;
struct tm timestamp_tm;
char timestamp_str[64];
const unsigned char *buf;
static void logfile_print(const char *msg, int severity,
cdtime_t timestamp_time) {
FILE *fh;
- _Bool do_close = 0;
+ bool do_close = 0;
char timestamp_str[64];
char level_str[16] = "";
static const char *config_keys[] = {"CpuPoolStats", "ReportBySerial"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static _Bool pool_stats = 0;
-static _Bool report_by_serial = 0;
+static bool pool_stats = 0;
+static bool report_by_serial = 0;
#if PERFSTAT_SUPPORTS_DONATION
-static _Bool donate_flag = 0;
+static bool donate_flag = 0;
#endif
static char serial[SYS_NMLN];
mr_regex_t *type;
mr_regex_t *type_instance;
llist_t *meta; /* Maps each meta key into mr_regex_t* */
- _Bool invert;
+ bool invert;
};
/*
pthread_t tid; /* poll thread id */
llist_t *dimms_list; /* DIMMs list */
pthread_mutex_t dimms_lock; /* lock for dimms cache */
- _Bool persist;
+ bool persist;
} mcelog_config_t;
typedef struct socket_adapter_s socket_adapter_t;
.receive = socket_receive,
};
-static _Bool mcelog_thread_running;
-static _Bool mcelog_apply_defaults;
+static bool mcelog_thread_running;
+static bool mcelog_apply_defaults;
static void mcelog_free_dimms_list_records(llist_t *dimms_list) {
};
typedef struct memcached_s memcached_t;
-static _Bool memcached_have_instances = 0;
+static bool memcached_have_instances = 0;
static void memcached_free(void *arg) {
memcached_t *st = arg;
} /* int config_add_instance */
static int memcached_config(oconfig_item_t *ci) {
- _Bool have_instance_block = 0;
+ bool have_instance_block = 0;
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
#error "No applicable input method."
#endif
-static _Bool values_absolute = 1;
-static _Bool values_percentage = 0;
+static bool values_absolute = 1;
+static bool values_percentage = 0;
static int memory_config(oconfig_item_t *ci) /* {{{ */
{
char *fields[8];
int numfields;
- _Bool detailed_slab_info = 0;
+ bool detailed_slab_info = 0;
gauge_t mem_total = 0;
gauge_t mem_used = 0;
"ShowPower", "Power", "IgnoreSelectedPower"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static _Bool show_cpu = 1;
-static _Bool show_cpu_cores = 1;
-static _Bool show_memory = 1;
-static _Bool show_temps = 1;
+static bool show_cpu = 1;
+static bool show_cpu_cores = 1;
+static bool show_memory = 1;
+static bool show_temps = 1;
static ignorelist_t *temp_ignore = NULL;
-static _Bool show_power = 1;
+static bool show_power = 1;
static ignorelist_t *power_ignore = NULL;
static int mic_init(void) {
#else
modbus_t *connection;
#endif
- _Bool is_connected;
+ bool is_connected;
}; /* }}} */
typedef struct mb_host_s mb_host_t;
* Data types
*/
struct mqtt_client_conf {
- _Bool publish;
+ bool publish;
char *name;
struct mosquitto *mosq;
- _Bool connected;
+ bool connected;
char *host;
int port;
/* For publishing */
char *topic_prefix;
- _Bool store_rates;
- _Bool retain;
+ bool store_rates;
+ bool retain;
/* For subscribing */
pthread_t thread;
- _Bool loop;
+ bool loop;
char *topic;
- _Bool clean_session;
+ bool clean_session;
c_complain_t complaint_cantpublish;
pthread_mutex_t lock;
int port;
int timeout;
- _Bool master_stats;
- _Bool slave_stats;
- _Bool innodb_stats;
- _Bool wsrep_stats;
+ bool master_stats;
+ bool slave_stats;
+ bool innodb_stats;
+ bool wsrep_stats;
- _Bool slave_notif;
- _Bool slave_io_running;
- _Bool slave_sql_running;
+ bool slave_notif;
+ bool slave_io_running;
+ bool slave_sql_running;
MYSQL *con;
- _Bool is_connected;
+ bool is_connected;
};
typedef struct mysql_database_s mysql_database_t; /* }}} */
static int cna_config_host(host_config_t *host, /* {{{ */
const oconfig_item_t *ci) {
oconfig_item_t *item;
- _Bool is_vfiler = 0;
+ bool is_vfiler = 0;
int status;
if (!strcasecmp(ci->key, "VFiler"))
const char *tc_type;
char tc_inst[DATA_MAX_NAME_LEN];
- _Bool stats_submitted = 0;
+ bool stats_submitted = 0;
if (nlh->nlmsg_type == RTM_NEWQDISC)
tc_type = "qdisc";
static int network_config_ttl = 0;
/* Ethernet - (IPv6 + UDP) = 1500 - (40 + 8) = 1452 */
static size_t network_config_packet_size = 1452;
-static _Bool network_config_forward = 0;
-static _Bool network_config_stats = 0;
+static bool network_config_forward = 0;
+static bool network_config_stats = 0;
static sockent_t *sending_sockets = NULL;
/*
* Private functions
*/
-static _Bool check_receive_okay(const value_list_t *vl) /* {{{ */
+static bool check_receive_okay(const value_list_t *vl) /* {{{ */
{
uint64_t time_sent = 0;
int status;
return 0;
return 1;
-} /* }}} _Bool check_receive_okay */
+} /* }}} bool check_receive_okay */
-static _Bool check_send_okay(const value_list_t *vl) /* {{{ */
+static bool check_send_okay(const value_list_t *vl) /* {{{ */
{
- _Bool received = 0;
+ bool received = 0;
int status;
if (network_config_forward)
/* By default, only *send* value lists that were not *received* by the
* network plugin. */
return !received;
-} /* }}} _Bool check_send_okay */
+} /* }}} bool check_send_okay */
-static _Bool check_notify_received(const notification_t *n) /* {{{ */
+static bool check_notify_received(const notification_t *n) /* {{{ */
{
for (notification_meta_t *ptr = n->meta; ptr != NULL; ptr = ptr->next)
if ((strcmp("network:received", ptr->name) == 0) &&
(ptr->type == NM_TYPE_BOOLEAN))
- return (_Bool)ptr->nm_value.nm_boolean;
+ return (bool)ptr->nm_value.nm_boolean;
return 0;
-} /* }}} _Bool check_notify_received */
+} /* }}} bool check_notify_received */
-static _Bool check_send_notify_okay(const notification_t *n) /* {{{ */
+static bool check_send_notify_okay(const notification_t *n) /* {{{ */
{
static c_complain_t complain_forwarding = C_COMPLAIN_INIT_STATIC;
- _Bool received = 0;
+ bool received = 0;
if (n->meta == NULL)
return 1;
/* By default, only *send* value lists that were not *received* by the
* network plugin. */
return !received;
-} /* }}} _Bool check_send_notify_okay */
+} /* }}} bool check_send_notify_okay */
static int network_dispatch_values(value_list_t *vl, /* {{{ */
const char *username) {
struct sockent_client *client;
struct addrinfo *ai_list;
int status;
- _Bool reconnect = 0;
+ bool reconnect = 0;
cdtime_t now;
if ((se == NULL) || (se->type != SOCKENT_TYPE_CLIENT))
} /* }}} int network_stats_read */
static int network_init(void) {
- static _Bool have_init = 0;
+ static bool have_init = 0;
/* Check if we were already initialized. If so, just return - there's
* nothing more to do (for now, that is). */
static const char *config_keys[] = {"ReportV2", "ReportV3", "ReportV4"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static _Bool report_v2 = 1;
-static _Bool report_v3 = 1;
-static _Bool report_v4 = 1;
+static bool report_v2 = 1;
+static bool report_v3 = 1;
+static bool report_v4 = 1;
/*
see /proc/net/rpc/nfs
"IncludeUnitID"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static _Bool do_reverse_lookups = 1;
+static bool do_reverse_lookups = 1;
/* This option only exists for backward compatibility. If it is false and two
* ntpd peers use the same refclock driver, the plugin will try to write
* simultaneous measurements from both to the same type instance. */
-static _Bool include_unit_id = 0;
+static bool include_unit_id = 0;
#define NTPD_DEFAULT_HOST "localhost"
#define NTPD_DEFAULT_PORT "123"
static int ntpd_get_name_from_address(char *buffer, size_t buffer_size,
struct info_peer_summary const *peer_info,
- _Bool do_reverse_lookup) {
+ bool do_reverse_lookup) {
struct sockaddr_storage sa = {0};
socklen_t sa_len;
int flags = 0;
static char *device_g = NULL;
static cdtime_t ow_interval = 0;
-static _Bool direct_access = 0;
+static bool direct_access = 0;
static const char *config_keys[] = {"Device", "IgnoreSelected", "Sensor",
"Interval"};
static ignorelist_t *sensor_list;
-static _Bool regex_direct_initialized = 0;
+static bool regex_direct_initialized = 0;
static regex_t regex_direct;
/**
char *password;
char *cacert;
char *host;
- _Bool starttls;
+ bool starttls;
int timeout;
char *url;
- _Bool verifyhost;
+ bool verifyhost;
int version;
LDAP *ld;
};
typedef struct vpn_status_s vpn_status_t;
-static _Bool new_naming_schema = 0;
-static _Bool collect_compression = 1;
-static _Bool collect_user_count = 0;
-static _Bool collect_individual_users = 1;
+static bool new_naming_schema = 0;
+static bool collect_compression = 1;
+static bool collect_user_count = 0;
+static bool collect_individual_users = 1;
static const char *config_keys[] = {
"StatusFile", "Compression", /* old, deprecated name */
char *fields[10];
const int max_fields = STATIC_ARRAY_SIZE(fields);
long long sum_users = 0;
- _Bool found_header = 0;
+ bool found_header = 0;
/* read the file until the "ROUTING TABLE" line is found (no more info after)
*/
const int max_fields = STATIC_ARRAY_SIZE(fields);
long long sum_users = 0;
- _Bool found_header = 0;
+ bool found_header = 0;
int idx_cname = 0;
int idx_bytes_recv = 0;
int idx_bytes_sent = 0;
/* OVS events configuration data */
struct ovs_events_config_s {
- _Bool send_notification; /* sent notification to collectd? */
+ bool send_notification; /* sent notification to collectd? */
char ovs_db_node[OVS_DB_ADDR_NODE_SIZE]; /* OVS DB node */
char ovs_db_serv[OVS_DB_ADDR_SERVICE_SIZE]; /* OVS DB service */
char ovs_db_unix[OVS_DB_ADDR_UNIX_SIZE]; /* OVS DB unix socket path */
ovs_db_t *ovs_db; /* pointer to OVS DB instance */
ovs_events_config_t config; /* plugin config */
char *ovs_db_select_params; /* OVS DB select parameter request */
- _Bool is_db_available; /* specify whether OVS DB is available */
+ bool is_db_available; /* specify whether OVS DB is available */
};
typedef struct ovs_events_ctx_s ovs_events_ctx_t;
* in allocated memory. Returns negative value in case of error.
*/
static int ovs_events_plugin_config(oconfig_item_t *ci) {
- _Bool dispatch_values = 0;
+ bool dispatch_values = 0;
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
if (strcasecmp("SendNotification", child->key) == 0) {
/* Read OVS DB interface link status callback */
static int ovs_events_plugin_read(__attribute__((unused)) user_data_t *u) {
- _Bool is_connected = 0;
+ bool is_connected = 0;
OVS_EVENTS_CTX_LOCK { is_connected = ovs_events_ctx.is_db_available; }
if (is_connected)
if (ovs_db_send_request(ovs_events_ctx.ovs_db, "transact",
typedef struct c_ithread_s {
/* the thread's Perl interpreter */
PerlInterpreter *interp;
- _Bool running; /* thread is inside Perl interpreter */
- _Bool shutdown;
+ bool running; /* thread is inside Perl interpreter */
+ bool shutdown;
pthread_t pthread;
/* double linked list of threads */
* private variables
*/
-static _Bool register_legacy_flush = 1;
+static bool register_legacy_flush = 1;
/* if perl_threads != NULL perl_threads->head must
* point to the "base" thread */
* Call perl sub with thread locking flags handled.
*/
static int call_pv_locked(pTHX_ const char *sub_name) {
- _Bool old_running;
+ bool old_running;
int ret;
c_ithread_t *t = (c_ithread_t *)pthread_getspecific(perl_thr_key);
static char const *pf_device = "/dev/pf";
static void pf_submit(char const *type, char const *type_instance, uint64_t val,
- _Bool is_gauge) {
+ bool is_gauge) {
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
static char *conf_node = NULL;
static char *conf_service = NULL;
-static _Bool collector_thread_running = 0;
-static _Bool collector_thread_do_shutdown = 0;
+static bool collector_thread_running = 0;
+static bool collector_thread_do_shutdown = 0;
static pthread_t collector_thread_id;
/* }}} */
pthread_mutex_lock(&ping_lock);
while (ping_thread_loop > 0) {
- _Bool send_successful = 0;
+ bool send_successful = 0;
if (gettimeofday(&tv_begin, NULL) < 0) {
ERROR("ping plugin: gettimeofday failed: %s", STRERRNO);
typedef struct {
char *name;
char *statement;
- _Bool store_rates;
+ bool store_rates;
} c_psql_writer_t;
typedef struct {
} /* c_psql_connect */
static int c_psql_check_connection(c_psql_database_t *db) {
- _Bool init = 0;
+ bool init = 0;
if (!db->conn) {
init = 1;
} /* values_name_to_sqlarray */
static char *values_type_to_sqlarray(const data_set_t *ds, char *string,
- size_t string_len, _Bool store_rates) {
+ size_t string_len, bool store_rates) {
char *str_ptr;
size_t str_len;
static char *values_to_sqlarray(const data_set_t *ds, const value_list_t *vl,
char *string, size_t string_len,
- _Bool store_rates) {
+ bool store_rates) {
char *str_ptr;
size_t str_len;
} /* c_psql_flush */
static int c_psql_shutdown(void) {
- _Bool had_flush = 0;
+ bool had_flush = 0;
plugin_unregister_read_group("postgresql");
c_psql_database_t *db;
char cb_name[DATA_MAX_NAME_LEN];
- static _Bool have_flush = 0;
+ static bool have_flush = 0;
if ((1 != ci->values_num) || (OCONFIG_TYPE_STRING != ci->values[0].type)) {
log_err("<Database> expects a single string argument.");
derive_t io_syscw;
derive_t io_diskr;
derive_t io_diskw;
- _Bool has_io;
+ bool has_io;
derive_t cswitch_vol;
derive_t cswitch_invol;
- _Bool has_cswitch;
+ bool has_cswitch;
#if HAVE_LIBTASKSTATS
ts_delay_t delay;
#endif
- _Bool has_delay;
+ bool has_delay;
- _Bool has_fd;
+ bool has_fd;
- _Bool has_maps;
+ bool has_maps;
} process_entry_t;
typedef struct procstat_entry_s {
gauge_t delay_swapin;
gauge_t delay_freepages;
- _Bool report_fd_num;
- _Bool report_maps_num;
- _Bool report_ctx_switch;
- _Bool report_delay;
+ bool report_fd_num;
+ bool report_maps_num;
+ bool report_ctx_switch;
+ bool report_delay;
struct procstat *next;
struct procstat_entry_s *instances;
static procstat_t *list_head_g = NULL;
-static _Bool want_init = 1;
-static _Bool report_ctx_switch = 0;
-static _Bool report_fd_num = 0;
-static _Bool report_maps_num = 0;
-static _Bool report_delay = 0;
+static bool want_init = 1;
+static bool report_ctx_switch = 0;
+static bool report_fd_num = 0;
+static bool report_maps_num = 0;
+static bool report_delay = 0;
#if HAVE_THREAD_INFO
static mach_port_t port_host_self;
FILE *proc_stat;
char buffer[1024];
value_t value;
- _Bool value_valid = 0;
+ bool value_valid = 0;
proc_stat = fopen("/proc/stat", "r");
if (proc_stat == NULL) {
* filter out threads (duplicate PID entries). */
if ((proc_ptr == NULL) || (proc_ptr->ki_pid != procs[i].ki_pid)) {
char cmdline[CMDLINE_BUFFER_SIZE] = "";
- _Bool have_cmdline = 0;
+ bool have_cmdline = 0;
proc_ptr = &(procs[i]);
/* Don't probe system processes and processes without arguments */
* filter out threads (duplicate PID entries). */
if ((proc_ptr == NULL) || (proc_ptr->p_pid != procs[i].p_pid)) {
char cmdline[CMDLINE_BUFFER_SIZE] = "";
- _Bool have_cmdline = 0;
+ bool have_cmdline = 0;
proc_ptr = &(procs[i]);
/* Don't probe zombie processes */
static pthread_t main_thread;
static PyOS_sighandler_t python_sigint_handler;
-static _Bool do_interactive = 0;
+static bool do_interactive = 0;
/* This is our global thread state. Python saves some stuff in thread-local
* storage. So if we allow the interpreter to run in the background
int64_t si;
uint64_t ui;
double d;
- _Bool b;
+ bool b;
type = meta_data_type(meta, table[i]);
if (type == MD_TYPE_STRING) {
#endif
sfree(encoding);
} else if (strcasecmp(item->key, "LogTraces") == 0) {
- _Bool log_traces;
+ bool log_traces;
if (cf_util_get_boolean(item, &log_traces) != 0) {
status = 1;
continue;
int (*add_signed_int)(void *, const char *, int64_t);
int (*add_unsigned_int)(void *, const char *, uint64_t);
int (*add_double)(void *, const char *, double);
- int (*add_boolean)(void *, const char *, _Bool);
+ int (*add_boolean)(void *, const char *, bool);
} cpy_build_meta_handler_t;
#define FreeAll() \
CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_signed_int, int64_t) \
CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_unsigned_int, uint64_t) \
CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_double, double) \
- CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_boolean, _Bool) \
+ CPY_BUILD_META_FUNC(meta_type, func_prefix##_add_boolean, bool) \
\
static cpy_build_meta_handler_t cpy_##func_prefix = { \
.add_string = cpy_##func_prefix##_add_string, \
char *username;
char *password;
- _Bool collect_interface;
- _Bool collect_regtable;
- _Bool collect_cpu_load;
- _Bool collect_memory;
- _Bool collect_df;
- _Bool collect_disk;
+ bool collect_interface;
+ bool collect_regtable;
+ bool collect_cpu_load;
+ bool collect_memory;
+ bool collect_df;
+ bool collect_disk;
};
typedef struct cr_data_s cr_data_t;
*/
static char *datadir = NULL;
static char *daemon_address = NULL;
-static _Bool config_create_files = 1;
-static _Bool config_collect_stats = 1;
+static bool config_create_files = 1;
+static bool config_collect_stats = 1;
static rrdcreate_config_t rrdcreate_config = {
/* stepsize = */ 0,
/* heartbeat = */ 0,
static int rc_read(void) {
int status;
rrdc_stats_t *head;
- _Bool retried = 0;
+ bool retried = 0;
value_list_t vl = VALUE_LIST_INIT;
vl.values = &(value_t){.gauge = NAN};
char values[512];
char *values_array[2];
int status;
- _Bool retried = 0;
+ bool retried = 0;
if (daemon_address == NULL) {
ERROR("rrdcached plugin: daemon_address == NULL.");
__attribute__((unused)) user_data_t *ud) {
char filename[PATH_MAX + 1];
int status;
- _Bool retried = 0;
+ bool retried = 0;
if (identifier == NULL)
return EINVAL;
} featurelist_t;
static char *conffile = NULL;
-static _Bool use_labels = 0;
+static bool use_labels = 0;
/* #endif (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500) */
#else /* if SENSORS_API_VERSION >= 0x500 */
while (fgets(buffer, sizeof(buffer), fh) != NULL) {
derive_t rx = 0;
derive_t tx = 0;
- _Bool have_rx = 0, have_tx = 0;
+ bool have_rx = 0, have_tx = 0;
size_t len;
char *fields[16];
struct data_definition_s {
char *name; /* used to reference this from the `Collect' option */
char *type; /* used to find the data_set */
- _Bool is_table;
+ bool is_table;
instance_t instance;
char *instance_prefix;
oid_t *values;
struct data_definition_s *next;
char **ignores;
size_t ignores_len;
- _Bool invert_match;
+ bool invert_match;
};
typedef struct data_definition_s data_definition_t;
value_t ret;
uint64_t tmp_unsigned = 0;
int64_t tmp_signed = 0;
- _Bool defined = 1;
+ bool defined = 1;
/* Set to true when the original SNMP type appears to have been signed. */
- _Bool prefer_signed = 0;
+ bool prefer_signed = 0;
if ((vl->type == ASN_INTEGER) || (vl->type == ASN_UINTEGER) ||
(vl->type == ASN_COUNTER)
char *ptr;
csnmp_strvbcopy(il->instance, vb, sizeof(il->instance));
- _Bool is_matched = 0;
+ bool is_matched = 0;
for (uint32_t i = 0; i < dd->ignores_len; i++) {
status = fnmatch(dd->ignores[i], il->instance, 0);
if (status == 0) {
csnmp_table_values_t *value_table_ptr[data->values_len];
size_t i;
- _Bool have_more;
+ bool have_more;
oid_t current_suffix;
ds = plugin_get_ds(data->type);
have_more = 1;
while (have_more) {
- _Bool suffix_skipped = 0;
+ bool suffix_skipped = 0;
/* Determine next suffix to handle. */
if (instance_list != NULL) {
oid_t oid_list[oid_list_len];
/* Set to false when an OID has left its subtree so we don't re-request it
* again. */
- _Bool oid_list_todo[oid_list_len];
+ bool oid_list_todo[oid_list_len];
int status;
size_t i;
char *type;
char *type_instance;
const table_definition_t *table;
- _Bool is_instance;
+ bool is_instance;
oid_t *oids;
size_t oids_len;
double scale;
static pthread_mutex_t metrics_lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t network_thread;
-static _Bool network_thread_running = 0;
-static _Bool network_thread_shutdown = 0;
+static bool network_thread_running = 0;
+static bool network_thread_shutdown = 0;
static char *conf_node = NULL;
static char *conf_service = NULL;
-static _Bool conf_delete_counters = 0;
-static _Bool conf_delete_timers = 0;
-static _Bool conf_delete_gauges = 0;
-static _Bool conf_delete_sets = 0;
+static bool conf_delete_counters = 0;
+static bool conf_delete_timers = 0;
+static bool conf_delete_gauges = 0;
+static bool conf_delete_sets = 0;
static double *conf_timer_percentile = NULL;
static size_t conf_timer_percentile_num = 0;
-static _Bool conf_counter_sum = 0;
-static _Bool conf_timer_lower = 0;
-static _Bool conf_timer_upper = 0;
-static _Bool conf_timer_sum = 0;
-static _Bool conf_timer_count = 0;
+static bool conf_counter_sum = 0;
+static bool conf_timer_lower = 0;
+static bool conf_timer_upper = 0;
+static bool conf_timer_sum = 0;
+static bool conf_timer_count = 0;
/* Must hold metrics_lock when calling this function. */
static statsd_metric_t *statsd_metric_lookup_unsafe(char const *name, /* {{{ */
if (metric->type == STATSD_GAUGE)
vl.values[0].gauge = (gauge_t)metric->value;
else if (metric->type == STATSD_TIMER) {
- _Bool have_events = (metric->updates_num > 0);
+ bool have_events = (metric->updates_num > 0);
/* Make sure all timer metrics share the *same* timestamp. */
vl.time = cdtime();
#if KERNEL_LINUX
#define SWAP_HAVE_REPORT_BY_DEVICE 1
static derive_t pagesize;
-static _Bool report_bytes = 0;
-static _Bool report_by_device = 0;
+static bool report_bytes = 0;
+static bool report_by_device = 0;
/* #endif KERNEL_LINUX */
#elif HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS
#define SWAP_HAVE_REPORT_BY_DEVICE 1
static derive_t pagesize;
-static _Bool report_by_device = 0;
+static bool report_by_device = 0;
/* #endif HAVE_SWAPCTL && HAVE_SWAPCTL_TWO_ARGS */
#elif HAVE_SWAPCTL && HAVE_SWAPCTL_THREE_ARGS
#error "No applicable input method."
#endif /* HAVE_LIBSTATGRAB */
-static _Bool values_absolute = 1;
-static _Bool values_percentage = 0;
-static _Bool report_io = 1;
+static bool values_absolute = 1;
+static bool values_percentage = 0;
+static bool report_io = 1;
static int swap_config(oconfig_item_t *ci) /* {{{ */
{
FILE *fh;
char buffer[1024];
- _Bool old_kernel = 0;
+ bool old_kernel = 0;
uint8_t have_data = 0;
derive_t swap_in = 0;
return tcsv_submit(id, md, v, t);
}
-static _Bool tcsv_check_index(ssize_t index, size_t fields_num,
+static bool tcsv_check_index(ssize_t index, size_t fields_num,
char const *name) {
if (index < 0)
return 1;
} /* int tcsv_config */
static int tcsv_init(void) { /* {{{ */
- static _Bool have_init = 0;
+ static bool have_init = 0;
metric_definition_t *md;
if (have_init)
struct tr_action_s {
regex_t re;
char *replacement;
- _Bool may_be_empty;
+ bool may_be_empty;
tr_action_t *next;
};
} /* }}} void tr_meta_data_action_destroy */
static int tr_config_add_action(tr_action_t **dest, /* {{{ */
- const oconfig_item_t *ci, _Bool may_be_empty) {
+ const oconfig_item_t *ci, bool may_be_empty) {
tr_action_t *act;
int status;
static int tr_config_add_meta_action(tr_meta_data_action_t **dest, /* {{{ */
const oconfig_item_t *ci,
- _Bool should_delete) {
+ bool should_delete) {
tr_meta_data_action_t *act;
int status;
static int tr_action_invoke(tr_action_t *act_head, /* {{{ */
char *buffer_in, size_t buffer_in_size,
- _Bool may_be_empty) {
+ bool may_be_empty) {
int status;
char buffer[DATA_MAX_NAME_LEN];
regmatch_t matches[8] = {[0] = {0}};
static int v5_zfs_arc_counts(const data_set_t *ds, value_list_t *vl) /* {{{ */
{
value_list_t new_vl;
- _Bool is_hits;
+ bool is_hits;
if (vl->values_len != 4)
return FC_TARGET_STOP;
#define OK1(cond, text) \
do { \
- _Bool result = (cond); \
+ bool result = (cond); \
LOG(result, text); \
if (!result) { \
return -1; \
static const char *const dirname_sysfs = "/sys/class/thermal";
static const char *const dirname_procfs = "/proc/acpi/thermal_zone";
-static _Bool force_procfs = 0;
+static bool force_procfs = 0;
static ignorelist_t *device_list;
enum dev_type { TEMP = 0, COOLING_DEV };
const char *name,
void __attribute__((unused)) * user_data) {
char filename[PATH_MAX];
- _Bool success = 0;
+ bool success = 0;
value_t value;
if (device_list && ignorelist_match(device_list, name))
*
* This value is automatically set if mperf or aperf go backward
*/
-static _Bool aperf_mperf_unstable;
+static bool aperf_mperf_unstable;
/*
* If set, use kernel logical core numbering for all "per core" metrics.
*/
-static _Bool config_lcn;
+static bool config_lcn;
/*
* Bitmask of the list of core C states supported by the processor.
*/
static unsigned int do_core_cstate;
static unsigned int config_core_cstate;
-static _Bool apply_config_core_cstate;
+static bool apply_config_core_cstate;
/*
* Bitmask of the list of pacages C states supported by the processor.
*/
static unsigned int do_pkg_cstate;
static unsigned int config_pkg_cstate;
-static _Bool apply_config_pkg_cstate;
+static bool apply_config_pkg_cstate;
/*
* Boolean indicating if the processor supports 'I/O System-Management Interrupt
* counter'
*/
-static _Bool do_smi;
-static _Bool config_smi;
-static _Bool apply_config_smi;
+static bool do_smi;
+static bool config_smi;
+static bool apply_config_smi;
/*
* Boolean indicating if the processor supports 'Digital temperature sensor'
* might be wrong
* - Temperatures above the tcc_activation_temp are not recorded
*/
-static _Bool do_dts;
-static _Bool config_dts;
-static _Bool apply_config_dts;
+static bool do_dts;
+static bool config_dts;
+static bool apply_config_dts;
/*
* Boolean indicating if the processor supports 'Package thermal management'
* might be wrong
* - Temperatures above the tcc_activation_temp are not recorded
*/
-static _Bool do_ptm;
-static _Bool config_ptm;
-static _Bool apply_config_ptm;
+static bool do_ptm;
+static bool config_ptm;
+static bool apply_config_ptm;
/*
* Thermal Control Circuit Activation Temperature as configured by the user.
static unsigned int do_rapl;
static unsigned int config_rapl;
-static _Bool apply_config_rapl;
+static bool apply_config_rapl;
static double rapl_energy_units;
#define RAPL_PKG (1 << 0)
#define DELTA_COUNTERS thread_delta, core_delta, package_delta
#define ODD_COUNTERS thread_odd, core_odd, package_odd
#define EVEN_COUNTERS thread_even, core_even, package_even
-static _Bool is_even = 1;
+static bool is_even = 1;
-static _Bool allocated = 0;
-static _Bool initialized = 0;
+static bool allocated = 0;
+static bool initialized = 0;
#define GET_THREAD(thread_base, thread_no, core_no, pkg_no) \
(thread_base + (pkg_no)*topology.num_cores * topology.num_threads + \
struct cpu_topology {
unsigned int package_id;
unsigned int core_id;
- _Bool first_core_in_package;
- _Bool first_thread_in_core;
+ bool first_core_in_package;
+ bool first_thread_in_core;
};
static struct topology {
* 1
*/
static int __attribute__((warn_unused_result))
-open_msr(unsigned int cpu, _Bool multiple_read) {
+open_msr(unsigned int cpu, bool multiple_read) {
char pathname[32];
int fd;
static char *sock_file = NULL;
static char *sock_group = NULL;
static int sock_perms = S_IRWXU | S_IRWXG;
-static _Bool delete_socket = 0;
+static bool delete_socket = 0;
static pthread_t listen_thread = (pthread_t)0;
cmd_status_t status;
cmd_t cmd;
- _Bool result;
+ bool result;
memset(&cmd, 0, sizeof(cmd));
oconfig_item_t *c = ci->children + i;
size_t field;
- _Bool enabled = 0;
+ bool enabled = 0;
for (field = 0; field < STATIC_ARRAY_SIZE(field_specs); ++field) {
if (!strcasecmp(c->key, field_specs[field].config_key))
}
static void gr_copy_escape_part(char *dst, const char *src, size_t dst_len,
- char escape_char, _Bool preserve_separator) {
+ char escape_char, bool preserve_separator) {
memset(dst, 0, dst_len);
if (src == NULL)
if (postfix == NULL)
postfix = "";
- _Bool preserve_separator = (flags & GRAPHITE_PRESERVE_SEPARATOR) ? 1 : 0;
+ bool preserve_separator = (flags & GRAPHITE_PRESERVE_SEPARATOR) ? 1 : 0;
gr_copy_escape_part(n_host, vl->host, sizeof(n_host), escape_char,
preserve_separator);
if (meta_data_get_double(meta, key, &value) == 0)
BUFFER_ADD(",\"%s\":%f", key, value);
} else if (type == MD_TYPE_BOOLEAN) {
- _Bool value = 0;
+ bool value = 0;
if (meta_data_get_boolean(meta, key, &value) == 0)
BUFFER_ADD(",\"%s\":%s", key, value ? "true" : "false");
}
}
static int expect_label(char const *name, char const *got, char const *want) {
- _Bool ok = (strcmp(got, want) == 0);
+ bool ok = (strcmp(got, want) == 0);
char msg[1024];
if (ok)
char *bucket_type;
/*
- _Bool lower;
- _Bool upper;
- _Bool avg;
+ bool lower;
+ bool upper;
+ bool avg;
*/
} latency_config_t;
/* Check if POLL thread is still running. Returns
* 1 if running otherwise 0 is returned */
-static _Bool ovs_db_poll_is_running(ovs_db_t *pdb) {
+static bool ovs_db_poll_is_running(ovs_db_t *pdb) {
int state = 0;
pthread_mutex_lock(&pdb->poll_thread.mutex);
state = pdb->poll_thread.state;
char **consolidation_functions;
size_t consolidation_functions_num;
- _Bool async;
+ bool async;
};
typedef struct rrdcreate_config_s rrdcreate_config_t;
struct part_match_s {
char str[DATA_MAX_NAME_LEN];
regex_t regex;
- _Bool is_regex;
+ bool is_regex;
};
typedef struct part_match_s part_match_t;
/*
* Private functions
*/
-static _Bool lu_part_matches(part_match_t const *match, /* {{{ */
+static bool lu_part_matches(part_match_t const *match, /* {{{ */
char const *str) {
if (match->is_regex) {
/* Short cut popular catch-all regex. */
return 1;
else
return 0;
-} /* }}} _Bool lu_part_matches */
+} /* }}} bool lu_part_matches */
static int lu_copy_ident_to_match_part(part_match_t *match_part, /* {{{ */
char const *ident_part) {
static by_type_entry_t *lu_search_by_type(lookup_t *obj, /* {{{ */
char const *type,
- _Bool allocate_if_missing) {
+ bool allocate_if_missing) {
by_type_entry_t *by_type;
char *type_copy;
int status;
#include "testing.h"
#include "utils_vl_lookup.h"
-static _Bool expect_new_obj = 0;
-static _Bool have_new_obj = 0;
+static bool expect_new_obj = 0;
+static bool have_new_obj = 0;
static lookup_identifier_t last_class_ident;
static lookup_identifier_t last_obj_ident;
static int checked_lookup_search(lookup_t *obj, char const *host,
char const *plugin,
char const *plugin_instance, char const *type,
- char const *type_instance, _Bool expect_new) {
+ char const *type_instance, bool expect_new) {
int status;
value_list_t vl = VALUE_LIST_INIT;
data_set_t const *ds = &ds_unknown;
struct user_config_s {
char *instance;
- _Bool collect_cache;
- _Bool collect_connections;
- _Bool collect_esi;
- _Bool collect_backend;
+ bool collect_cache;
+ bool collect_connections;
+ bool collect_esi;
+ bool collect_backend;
#ifdef HAVE_VARNISH_V3
- _Bool collect_dirdns;
+ bool collect_dirdns;
#endif
- _Bool collect_fetch;
- _Bool collect_hcb;
- _Bool collect_objects;
+ bool collect_fetch;
+ bool collect_hcb;
+ bool collect_objects;
#if HAVE_VARNISH_V2
- _Bool collect_purge;
+ bool collect_purge;
#else
- _Bool collect_ban;
+ bool collect_ban;
#endif
- _Bool collect_session;
- _Bool collect_shm;
- _Bool collect_sms;
+ bool collect_session;
+ bool collect_shm;
+ bool collect_sms;
#if HAVE_VARNISH_V2
- _Bool collect_sm;
+ bool collect_sm;
#endif
#if HAVE_VARNISH_V2 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
- _Bool collect_sma;
+ bool collect_sma;
#endif
- _Bool collect_struct;
- _Bool collect_totals;
+ bool collect_struct;
+ bool collect_totals;
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4 || HAVE_VARNISH_V5
- _Bool collect_uptime;
+ bool collect_uptime;
#endif
- _Bool collect_vcl;
- _Bool collect_workers;
+ bool collect_vcl;
+ bool collect_workers;
#if HAVE_VARNISH_V4 || HAVE_VARNISH_V5
- _Bool collect_vsm;
- _Bool collect_lck;
- _Bool collect_mempool;
- _Bool collect_mgt;
- _Bool collect_smf;
- _Bool collect_vbe;
- _Bool collect_mse;
+ bool collect_vsm;
+ bool collect_lck;
+ bool collect_mempool;
+ bool collect_mgt;
+ bool collect_smf;
+ bool collect_vbe;
+ bool collect_mse;
#endif
};
typedef struct user_config_s user_config_t; /* }}} */
-static _Bool have_instance = 0;
+static bool have_instance = 0;
static int varnish_submit(const char *plugin_instance, /* {{{ */
const char *category, const char *type,
{
#if HAVE_VARNISH_V3 || HAVE_VARNISH_V4
struct VSM_data *vd;
- _Bool ok;
+ bool ok;
const c_varnish_stats_t *stats;
#elif HAVE_VARNISH_V5
struct vsm *vd;
};
/* BlockDeviceFormatBasename */
-_Bool blockdevice_format_basename = 0;
+bool blockdevice_format_basename = 0;
static enum bd_field blockdevice_format = target;
static enum if_field interface_format = if_name;
unsigned char *cpu_maps, int cpu_map_len) {
for (int cpu = 0; cpu < max_cpus; ++cpu) {
char type_instance[DATA_MAX_NAME_LEN];
- _Bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0;
+ bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0;
snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu, cpu);
submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1);
char *node;
char *service;
char *protocol;
- _Bool log_send_errors;
+ bool log_send_errors;
char *prefix;
char *postfix;
char escape_char;
/* Force reconnect useful for load balanced environments */
cdtime_t last_reconnect_time;
cdtime_t reconnect_interval;
- _Bool reconnect_interval_reached;
+ bool reconnect_interval_reached;
};
/* wg_force_reconnect_check closes cb->sock_fd when it was open for longer
char *user;
char *pass;
char *credentials;
- _Bool verify_peer;
- _Bool verify_host;
+ bool verify_peer;
+ bool verify_host;
char *cacert;
char *capath;
char *clientkey;
char *clientcert;
char *clientkeypass;
long sslversion;
- _Bool store_rates;
- _Bool log_http_error;
+ bool store_rates;
+ bool log_http_error;
int low_speed_limit;
time_t low_speed_time;
int timeout;
#define WH_FORMAT_JSON 1
#define WH_FORMAT_KAIROSDB 2
int format;
- _Bool send_metrics;
- _Bool send_notifications;
+ bool send_metrics;
+ bool send_notifications;
CURL *curl;
struct curl_slist *headers;
#define KAFKA_FORMAT_GRAPHITE 2
uint8_t format;
unsigned int graphite_flags;
- _Bool store_rates;
+ bool store_rates;
rd_kafka_topic_conf_t *conf;
rd_kafka_topic_t *topic;
rd_kafka_conf_t *kafka_conf;
static int wl_config(oconfig_item_t *ci) /* {{{ */
{
- _Bool format_seen = 0;
+ bool format_seen = 0;
for (int i = 0; i < ci->children_num; i++) {
oconfig_item_t *child = ci->children + i;
char *user;
char *passwd;
- _Bool store_rates;
- _Bool connected;
+ bool store_rates;
+ bool connected;
mongoc_client_t *client;
mongoc_database_t *database;
* Functions
*/
static bson_t *wm_create_bson(const data_set_t *ds, /* {{{ */
- const value_list_t *vl, _Bool store_rates) {
+ const value_list_t *vl, bool store_rates) {
bson_t *ret;
bson_t subarray;
gauge_t *rates;
char const *accept = MHD_lookup_connection_value(connection, MHD_HEADER_KIND,
MHD_HTTP_HEADER_ACCEPT);
- _Bool want_proto =
+ bool want_proto =
(accept != NULL) &&
(strstr(accept, "application/vnd.google.protobuf") != NULL);
* necessary. */
static Io__Prometheus__Client__MetricFamily *
metric_family_get(data_set_t const *ds, value_list_t const *vl, size_t ds_index,
- _Bool allocate) {
+ bool allocate) {
char *name = metric_family_name(ds, vl, ds_index);
if (name == NULL) {
ERROR("write_prometheus plugin: Allocating metric family name failed.");
int database;
int max_set_size;
int max_set_duration;
- _Bool store_rates;
+ bool store_rates;
redisContext *conn;
pthread_mutex_t lock;
char *name;
char *event_service_prefix;
pthread_mutex_t lock;
- _Bool batch_mode;
- _Bool notifications;
- _Bool check_thresholds;
- _Bool store_rates;
- _Bool always_append_ds;
+ bool batch_mode;
+ bool notifications;
+ bool check_thresholds;
+ bool store_rates;
+ bool always_append_ds;
char *node;
int port;
riemann_client_type_t client_type;
#define F_READY 0x01
uint8_t flags;
pthread_mutex_t lock;
- _Bool notifications;
- _Bool metrics;
- _Bool store_rates;
- _Bool always_append_ds;
+ bool notifications;
+ bool metrics;
+ bool store_rates;
+ bool always_append_ds;
char *separator;
char *node;
char *service;
char *service;
char *host_tags;
- _Bool store_rates;
- _Bool always_append_ds;
+ bool store_rates;
+ bool always_append_ds;
char send_buf[WT_SEND_BUF_SIZE];
size_t send_buf_free;
pthread_mutex_t send_lock;
- _Bool connect_failed_log_enabled;
+ bool connect_failed_log_enabled;
int connect_dns_failed_attempts_remaining;
cdtime_t next_random_ttl;
};
static int wt_format_values(char *ret, size_t ret_len, int ds_num,
const data_set_t *ds, const value_list_t *vl,
- _Bool store_rates) {
+ bool store_rates) {
size_t offset = 0;
int status;
gauge_t *rates = NULL;