projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Run all changed files 68 8.c/1*.h through clang-format
[collectd.git]
/
src
/
cgroups.c
diff --git
a/src/cgroups.c
b/src/cgroups.c
index
9cb7cf9
..
8925239
100644
(file)
--- a/
src/cgroups.c
+++ b/
src/cgroups.c
@@
-23,15
+23,15
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
-#include "utils_ignorelist.h"
-#include "utils_mount.h"
+#include "utils/common/common.h"
+#include "utils/ignorelist/ignorelist.h"
+#include "utils/mount/mount.h"
static char const *config_keys[] = {"CGroup", "IgnoreSelected"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
static char const *config_keys[] = {"CGroup", "IgnoreSelected"};
static int config_keys_num = STATIC_ARRAY_SIZE(config_keys);
-static ignorelist_t *il_cgroup
= NULL
;
+static ignorelist_t *il_cgroup;
__attribute__((nonnull(1))) __attribute__((nonnull(2))) static void
cgroups_submit_one(char const *plugin_instance, char const *type_instance,
__attribute__((nonnull(1))) __attribute__((nonnull(2))) static void
cgroups_submit_one(char const *plugin_instance, char const *type_instance,
@@
-63,7
+63,7
@@
static int read_cpuacct_procs(const char *dirname, char const *cgroup_name,
if (ignorelist_match(il_cgroup, cgroup_name))
return 0;
if (ignorelist_match(il_cgroup, cgroup_name))
return 0;
- s
s
nprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, cgroup_name);
+ snprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, cgroup_name);
status = lstat(abs_path, &statbuf);
if (status != 0) {
status = lstat(abs_path, &statbuf);
if (status != 0) {
@@
-75,13
+75,11
@@
static int read_cpuacct_procs(const char *dirname, char const *cgroup_name,
if (!S_ISDIR(statbuf.st_mode))
return 0;
if (!S_ISDIR(statbuf.st_mode))
return 0;
- s
s
nprintf(abs_path, sizeof(abs_path), "%s/%s/cpuacct.stat", dirname,
-
cgroup_name);
+ snprintf(abs_path, sizeof(abs_path), "%s/%s/cpuacct.stat", dirname,
+ cgroup_name);
fh = fopen(abs_path, "r");
if (fh == NULL) {
fh = fopen(abs_path, "r");
if (fh == NULL) {
- char errbuf[1024];
- ERROR("cgroups plugin: fopen (\"%s\") failed: %s", abs_path,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("cgroups plugin: fopen (\"%s\") failed: %s", abs_path, STRERRNO);
return -1;
}
return -1;
}
@@
-114,7
+112,7
@@
static int read_cpuacct_procs(const char *dirname, char const *cgroup_name,
/* Strip colon off the first column, if found */
if (key[key_len - 1] == ':')
/* Strip colon off the first column, if found */
if (key[key_len - 1] == ':')
- key[key_len - 1] =
0
;
+ key[key_len - 1] =
'\0'
;
status = parse_value(fields[1], &value, DS_TYPE_DERIVE);
if (status != 0)
status = parse_value(fields[1], &value, DS_TYPE_DERIVE);
if (status != 0)
@@
-138,7
+136,7
@@
static int read_cpuacct_root(const char *dirname, const char *filename,
struct stat statbuf;
int status;
struct stat statbuf;
int status;
- s
s
nprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, filename);
+ snprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, filename);
status = lstat(abs_path, &statbuf);
if (status != 0) {
status = lstat(abs_path, &statbuf);
if (status != 0) {
@@
-183,7
+181,7
@@
static int cgroups_config(const char *key, const char *value) {
static int cgroups_read(void) {
cu_mount_t *mnt_list = NULL;
static int cgroups_read(void) {
cu_mount_t *mnt_list = NULL;
-
_Bool cgroup_found = 0
;
+
bool cgroup_found = false
;
if (cu_mount_getlist(&mnt_list) == NULL) {
ERROR("cgroups plugin: cu_mount_getlist failed.");
if (cu_mount_getlist(&mnt_list) == NULL) {
ERROR("cgroups plugin: cu_mount_getlist failed.");
@@
-201,7
+199,7
@@
static int cgroups_read(void) {
walk_directory(mnt_ptr->dir, read_cpuacct_root,
/* user_data = */ NULL,
/* include_hidden = */ 0);
walk_directory(mnt_ptr->dir, read_cpuacct_root,
/* user_data = */ NULL,
/* include_hidden = */ 0);
- cgroup_found =
1
;
+ cgroup_found =
true
;
/* It doesn't make sense to check other cpuacct mount-points
* (if any), they contain the same data. */
break;
/* It doesn't make sense to check other cpuacct mount-points
* (if any), they contain the same data. */
break;