X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Flpar.c;h=df18b525fa513095a823ae9b63cd86493fc91b3e;hp=3ecf0495fada9167ee899d09d4692bd14bb71719;hb=06a86a60a7dabc685bdbd81ce3d36ea5f7e2c2d4;hpb=88bd89f106abd5c0a9f9a80246e31a16c36a3c6d diff --git a/src/lpar.c b/src/lpar.c index 3ecf0495..df18b525 100644 --- a/src/lpar.c +++ b/src/lpar.c @@ -40,10 +40,10 @@ 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; +static bool report_by_serial; #if PERFSTAT_SUPPORTS_DONATION -static _Bool donate_flag = 0; +static bool donate_flag; #endif static char serial[SYS_NMLN]; @@ -52,14 +52,14 @@ static perfstat_partition_total_t lparstats_old; static int lpar_config(const char *key, const char *value) { if (strcasecmp("CpuPoolStats", key) == 0) { if (IS_TRUE(value)) - pool_stats = 1; + pool_stats = true; else - pool_stats = 0; + pool_stats = false; } else if (strcasecmp("ReportBySerial", key) == 0) { if (IS_TRUE(value)) - report_by_serial = 1; + report_by_serial = true; else - report_by_serial = 0; + report_by_serial = false; } else { return -1; } @@ -76,23 +76,22 @@ static int lpar_init(void) { sizeof(perfstat_partition_total_t), /* number = */ 1 /* (must be 1) */); if (status != 1) { - char errbuf[1024]; - ERROR("lpar plugin: perfstat_partition_total failed: %s (%i)", - sstrerror(errno, errbuf, sizeof(errbuf)), status); + ERROR("lpar plugin: perfstat_partition_total failed: %s (%i)", STRERRNO, + status); return -1; } #if PERFSTAT_SUPPORTS_DONATION if (!lparstats_old.type.b.shared_enabled && lparstats_old.type.b.donate_enabled) { - donate_flag = 1; + donate_flag = true; } #endif if (pool_stats && !lparstats_old.type.b.pool_util_authority) { WARNING("lpar plugin: This partition does not have pool authority. " "Disabling CPU pool statistics collection."); - pool_stats = 0; + pool_stats = false; } return 0; @@ -138,9 +137,8 @@ static int lpar_read(void) { &lparstats, sizeof(perfstat_partition_total_t), /* number = */ 1 /* (must be 1) */); if (status != 1) { - char errbuf[1024]; - ERROR("lpar plugin: perfstat_partition_total failed: %s (%i)", - sstrerror(errno, errbuf, sizeof(errbuf)), status); + ERROR("lpar plugin: perfstat_partition_total failed: %s (%i)", STRERRNO, + status); return -1; }