projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove LVM plugin
[collectd.git]
/
src
/
contextswitch.c
diff --git
a/src/contextswitch.c
b/src/contextswitch.c
index
1d73f04
..
d23d071
100644
(file)
--- a/
src/contextswitch.c
+++ b/
src/contextswitch.c
@@
-23,14
+23,11
@@
#include "collectd.h"
#include "collectd.h"
-#include "common.h"
#include "plugin.h"
#include "plugin.h"
+#include "utils/common/common.h"
-#if
def HAVE_SYS_SYSCTL_H
+#if
defined(HAVE_SYSCTLBYNAME) && defined(HAVE_SYS_SYSCTL_H)
#include <sys/sysctl.h>
#include <sys/sysctl.h>
-#endif
-
-#if HAVE_SYSCTLBYNAME
/* no global variables */
/* #endif HAVE_SYSCTLBYNAME */
/* no global variables */
/* #endif HAVE_SYSCTLBYNAME */
@@
-69,11
+66,11
@@
static int cs_read(void) {
if (status != 0) {
ERROR("contextswitch plugin: sysctlbyname "
"(vm.stats.sys.v_swtch) failed");
if (status != 0) {
ERROR("contextswitch plugin: sysctlbyname "
"(vm.stats.sys.v_swtch) failed");
- return
(-1)
;
+ return
-1
;
}
cs_submit(value);
}
cs_submit(value);
-/* #endif HAVE_SYSCTLBYNAME */
+
/* #endif HAVE_SYSCTLBYNAME */
#elif KERNEL_LINUX
FILE *fh;
#elif KERNEL_LINUX
FILE *fh;
@@
-85,9
+82,8
@@
static int cs_read(void) {
fh = fopen("/proc/stat", "r");
if (fh == NULL) {
fh = fopen("/proc/stat", "r");
if (fh == NULL) {
- ERROR("contextswitch plugin: unable to open /proc/stat: %s",
- sstrerror(errno, buffer, sizeof(buffer)));
- return (-1);
+ ERROR("contextswitch plugin: unable to open /proc/stat: %s", STRERRNO);
+ return -1;
}
while (fgets(buffer, sizeof(buffer), fh) != NULL) {
}
while (fgets(buffer, sizeof(buffer), fh) != NULL) {
@@
-117,7
+113,7
@@
static int cs_read(void) {
if (status == -2)
ERROR("contextswitch plugin: Unable to find context switch value.");
if (status == -2)
ERROR("contextswitch plugin: Unable to find context switch value.");
-/* #endif KERNEL_LINUX */
+
/* #endif KERNEL_LINUX */
#elif HAVE_PERFSTAT
int status = 0;
#elif HAVE_PERFSTAT
int status = 0;
@@
-126,10
+122,8
@@
static int cs_read(void) {
status =
perfstat_cpu_total(NULL, &perfcputotal, sizeof(perfstat_cpu_total_t), 1);
if (status < 0) {
status =
perfstat_cpu_total(NULL, &perfcputotal, sizeof(perfstat_cpu_total_t), 1);
if (status < 0) {
- char errbuf[1024];
- ERROR("contextswitch plugin: perfstat_cpu_total: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
- return (-1);
+ ERROR("contextswitch plugin: perfstat_cpu_total: %s", STRERRNO);
+ return -1;
}
cs_submit(perfcputotal.pswitch);
}
cs_submit(perfcputotal.pswitch);