projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #3238 from ccin2p3/f/syslog-debug-level
[collectd.git]
/
src
/
vserver.c
diff --git
a/src/vserver.c
b/src/vserver.c
index
a2ca0de
..
424a218
100644
(file)
--- a/
src/vserver.c
+++ b/
src/vserver.c
@@
-28,8
+28,8
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
#include <dirent.h>
#include <sys/types.h>
#include <dirent.h>
#include <sys/types.h>
@@
-42,7
+42,7
@@
#error "No applicable input method."
#endif
#error "No applicable input method."
#endif
-static int pagesize
= 0
;
+static int pagesize;
static int vserver_init(void) {
/* XXX Should we check for getpagesize () in configure?
static int vserver_init(void) {
/* XXX Should we check for getpagesize () in configure?
@@
-57,7
+57,8
@@
static void traffic_submit(const char *plugin_instance,
derive_t tx) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
derive_t tx) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.derive = rx}, {.derive = tx},
+ {.derive = rx},
+ {.derive = tx},
};
vl.values = values;
};
vl.values = values;
@@
-74,7
+75,9
@@
static void load_submit(const char *plugin_instance, gauge_t snum, gauge_t mnum,
gauge_t lnum) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
gauge_t lnum) {
value_list_t vl = VALUE_LIST_INIT;
value_t values[] = {
- {.gauge = snum}, {.gauge = mnum}, {.gauge = lnum},
+ {.gauge = snum},
+ {.gauge = mnum},
+ {.gauge = lnum},
};
vl.values = values;
};
vl.values = values;
@@
-124,9
+127,7
@@
static int vserver_read(void) {
errno = 0;
proc = opendir(PROCDIR);
if (proc == NULL) {
errno = 0;
proc = opendir(PROCDIR);
if (proc == NULL) {
- char errbuf[1024];
- ERROR("vserver plugin: fopen (%s): %s", PROCDIR,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("vserver plugin: fopen (%s): %s", PROCDIR, STRERRNO);
return -1;
}
return -1;
}
@@
-146,13
+147,11
@@
static int vserver_read(void) {
errno = 0;
dent = readdir(proc);
if (dent == NULL) {
errno = 0;
dent = readdir(proc);
if (dent == NULL) {
- char errbuf[4096];
-
if (errno == 0) /* end of directory */
break;
ERROR("vserver plugin: failed to read directory %s: %s", PROCDIR,
if (errno == 0) /* end of directory */
break;
ERROR("vserver plugin: failed to read directory %s: %s", PROCDIR,
-
sstrerror(errno, errbuf, sizeof(errbuf))
);
+
STRERRNO
);
closedir(proc);
return -1;
}
closedir(proc);
return -1;
}
@@
-160,15
+159,13
@@
static int vserver_read(void) {
if (dent->d_name[0] == '.')
continue;
if (dent->d_name[0] == '.')
continue;
- len = s
s
nprintf(file, sizeof(file), PROCDIR "/%s", dent->d_name);
+ len = snprintf(file, sizeof(file), PROCDIR "/%s", dent->d_name);
if ((len < 0) || (len >= BUFSIZE))
continue;
status = stat(file, &statbuf);
if (status != 0) {
if ((len < 0) || (len >= BUFSIZE))
continue;
status = stat(file, &statbuf);
if (status != 0) {
- char errbuf[4096];
- WARNING("vserver plugin: stat (%s) failed: %s", file,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ WARNING("vserver plugin: stat (%s) failed: %s", file, STRERRNO);
continue;
}
continue;
}
@@
-176,14
+173,12
@@
static int vserver_read(void) {
continue;
/* socket message accounting */
continue;
/* socket message accounting */
- len = s
s
nprintf(file, sizeof(file), PROCDIR "/%s/cacct", dent->d_name);
+ len = snprintf(file, sizeof(file), PROCDIR "/%s/cacct", dent->d_name);
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
if (NULL == (fh = fopen(file, "r"))) {
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
if (NULL == (fh = fopen(file, "r"))) {
- char errbuf[1024];
- ERROR("Cannot open '%s': %s", file,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("Cannot open '%s': %s", file, STRERRNO);
}
while ((fh != NULL) && (NULL != fgets(buffer, BUFSIZE, fh))) {
}
while ((fh != NULL) && (NULL != fgets(buffer, BUFSIZE, fh))) {
@@
-220,14
+215,12
@@
static int vserver_read(void) {
}
/* thread information and load */
}
/* thread information and load */
- len = s
s
nprintf(file, sizeof(file), PROCDIR "/%s/cvirt", dent->d_name);
+ len = snprintf(file, sizeof(file), PROCDIR "/%s/cvirt", dent->d_name);
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
if (NULL == (fh = fopen(file, "r"))) {
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
if (NULL == (fh = fopen(file, "r"))) {
- char errbuf[1024];
- ERROR("Cannot open '%s': %s", file,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("Cannot open '%s': %s", file, STRERRNO);
}
while ((fh != NULL) && (NULL != fgets(buffer, BUFSIZE, fh))) {
}
while ((fh != NULL) && (NULL != fgets(buffer, BUFSIZE, fh))) {
@@
-266,14
+259,12
@@
static int vserver_read(void) {
}
/* processes and memory usage */
}
/* processes and memory usage */
- len = s
s
nprintf(file, sizeof(file), PROCDIR "/%s/limit", dent->d_name);
+ len = snprintf(file, sizeof(file), PROCDIR "/%s/limit", dent->d_name);
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
if (NULL == (fh = fopen(file, "r"))) {
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
if (NULL == (fh = fopen(file, "r"))) {
- char errbuf[1024];
- ERROR("Cannot open '%s': %s", file,
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("Cannot open '%s': %s", file, STRERRNO);
}
while ((fh != NULL) && (NULL != fgets(buffer, BUFSIZE, fh))) {
}
while ((fh != NULL) && (NULL != fgets(buffer, BUFSIZE, fh))) {