X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fcontextswitch.c;h=d23d071713b0e77e5152d0e1c98673ce057c167a;hp=461fb0a9da502b808348e14f32360fe19cce854c;hb=48efd3deb4c9139fd060ff3d289896e9031bcc7c;hpb=867ad628dc6fcd05bd584b605d7093cfc00c3d07 diff --git a/src/contextswitch.c b/src/contextswitch.c index 461fb0a9..d23d0717 100644 --- a/src/contextswitch.c +++ b/src/contextswitch.c @@ -23,14 +23,11 @@ #include "collectd.h" -#include "common.h" #include "plugin.h" +#include "utils/common/common.h" -#ifdef HAVE_SYS_SYSCTL_H +#if defined(HAVE_SYSCTLBYNAME) && defined(HAVE_SYS_SYSCTL_H) #include -#endif - -#if HAVE_SYSCTLBYNAME /* no global variables */ /* #endif HAVE_SYSCTLBYNAME */ @@ -73,7 +70,7 @@ static int cs_read(void) { } cs_submit(value); -/* #endif HAVE_SYSCTLBYNAME */ + /* #endif HAVE_SYSCTLBYNAME */ #elif KERNEL_LINUX FILE *fh; @@ -85,8 +82,7 @@ static int cs_read(void) { fh = fopen("/proc/stat", "r"); if (fh == NULL) { - ERROR("contextswitch plugin: unable to open /proc/stat: %s", - sstrerror(errno, buffer, sizeof(buffer))); + ERROR("contextswitch plugin: unable to open /proc/stat: %s", STRERRNO); return -1; } @@ -117,7 +113,7 @@ static int cs_read(void) { if (status == -2) ERROR("contextswitch plugin: Unable to find context switch value."); -/* #endif KERNEL_LINUX */ + /* #endif KERNEL_LINUX */ #elif HAVE_PERFSTAT int status = 0; @@ -126,9 +122,7 @@ static int cs_read(void) { 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))); + ERROR("contextswitch plugin: perfstat_cpu_total: %s", STRERRNO); return -1; }