X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fcpufreq.c;h=7a5c8fdf43079d68b1dc0352a5133f8bd5a75143;hb=5afa2f82d43e2a7952d8f347f6f40b5778c59db8;hp=46e8659882381443dc8dc482b008fa2e6e1a2e72;hpb=838af4cdc6c8674ed3e14a95fea172118c707a85;p=collectd.git diff --git a/src/cpufreq.c b/src/cpufreq.c index 46e86598..7a5c8fdf 100644 --- a/src/cpufreq.c +++ b/src/cpufreq.c @@ -32,16 +32,6 @@ # define CPUFREQ_HAVE_READ 0 #endif -static data_source_t data_source[1] = -{ - {"value", DS_TYPE_GAUGE, 0, NAN} -}; - -static data_set_t data_set = -{ - "cpufreq", 1, data_source -}; - #if CPUFREQ_HAVE_READ #ifdef KERNEL_LINUX static int num_cpu = 0; @@ -117,19 +107,31 @@ static int cpufreq_read (void) if ((fp = fopen (filename, "r")) == NULL) { - WARNING ("cpufreq: fopen: %s", strerror (errno)); + char errbuf[1024]; + WARNING ("cpufreq: fopen (%s): %s", filename, + sstrerror (errno, errbuf, + sizeof (errbuf))); return (-1); } if (fgets (buffer, 16, fp) == NULL) { - WARNING ("cpufreq: fgets: %s", strerror (errno)); + char errbuf[1024]; + WARNING ("cpufreq: fgets: %s", + sstrerror (errno, errbuf, + sizeof (errbuf))); fclose (fp); return (-1); } if (fclose (fp)) - WARNING ("cpufreq: fclose: %s", strerror (errno)); + { + char errbuf[1024]; + WARNING ("cpufreq: fclose: %s", + sstrerror (errno, errbuf, + sizeof (errbuf))); + } + /* You're seeing correctly: The file is reporting kHz values.. */ val = atoll (buffer) * 1000; @@ -145,8 +147,6 @@ static int cpufreq_read (void) void module_register (void) { - plugin_register_data_set (&data_set); - #if CPUFREQ_HAVE_READ plugin_register_init ("cpufreq", cpufreq_init); plugin_register_read ("cpufreq", cpufreq_read);