projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tree wide: Replace sstrerror() with STRERRNO.
[collectd.git]
/
src
/
hugepages.c
diff --git
a/src/hugepages.c
b/src/hugepages.c
index
f62df83
..
29a7f9e
100644
(file)
--- a/
src/hugepages.c
+++ b/
src/hugepages.c
@@
-76,23
+76,22
@@
static int hp_config(oconfig_item_t *ci) {
child->key);
}
child->key);
}
- return
(0)
;
+ return
0
;
}
static void submit_hp(const struct entry_info *info) {
value_list_t vl = VALUE_LIST_INIT;
}
static void submit_hp(const struct entry_info *info) {
value_list_t vl = VALUE_LIST_INIT;
- vl.values = &(value_t)
{ .gauge = NAN
};
+ vl.values = &(value_t)
{.gauge = NAN
};
vl.values_len = 1;
vl.values_len = 1;
- sstrncpy(vl.host, hostname_g, sizeof(vl.host));
sstrncpy(vl.plugin, g_plugin_name, sizeof(vl.plugin));
if (info->node) {
sstrncpy(vl.plugin, g_plugin_name, sizeof(vl.plugin));
if (info->node) {
- s
s
nprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%zuKb",
-
info->node, info->page_size_kb);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%zuKb",
+ info->node, info->page_size_kb);
} else {
} else {
- s
s
nprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%zuKb",
-
info->page_size_kb);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%zuKb",
+ info->page_size_kb);
}
/* ensure all metrics have the same timestamp */
}
/* ensure all metrics have the same timestamp */
@@
-126,7
+125,7
@@
static int read_hugepage_entry(const char *path, const char *entry,
struct entry_info *info = e_info;
double value;
struct entry_info *info = e_info;
double value;
- s
s
nprintf(path2, sizeof(path2), "%s/%s", path, entry);
+ snprintf(path2, sizeof(path2), "%s/%s", path, entry);
FILE *fh = fopen(path2, "rt");
if (fh == NULL) {
FILE *fh = fopen(path2, "rt");
if (fh == NULL) {
@@
-186,15
+185,13
@@
static int read_syshugepages(const char *path, const char *node) {
long page_size = strtol(result->d_name + strlen(hugepages_dir),
/* endptr = */ NULL, /* base = */ 10);
if (errno != 0) {
long page_size = strtol(result->d_name + strlen(hugepages_dir),
/* endptr = */ NULL, /* base = */ 10);
if (errno != 0) {
- char errbuf[1024];
ERROR("%s: failed to determine page size from directory name \"%s\": %s",
ERROR("%s: failed to determine page size from directory name \"%s\": %s",
- g_plugin_name, result->d_name,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ g_plugin_name, result->d_name, STRERRNO);
continue;
}
/* /sys/devices/system/node/node?/hugepages/ */
continue;
}
/* /sys/devices/system/node/node?/hugepages/ */
- s
s
nprintf(path2, sizeof(path2), "%s/%s", path, result->d_name);
+ snprintf(path2, sizeof(path2), "%s/%s", path, result->d_name);
walk_directory(path2, read_hugepage_entry,
&(struct entry_info){
walk_directory(path2, read_hugepage_entry,
&(struct entry_info){
@@
-239,7
+236,7
@@
static int read_nodes(void) {
continue;
}
continue;
}
- s
s
nprintf(path, sizeof(path), sys_node_hugepages, result->d_name);
+ snprintf(path, sizeof(path), sys_node_hugepages, result->d_name);
read_syshugepages(path, result->d_name);
errno = 0;
}
read_syshugepages(path, result->d_name);
errno = 0;
}