X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fapple_sensors.c;h=f78c3da2025413e576d6d6e51ac0ef077d94e576;hp=d15bec42e2620f39d197236e3b18ca8a33fcf98a;hb=1159cb5d383c55a80a0db100b8f7aadcf44740a5;hpb=79963d13c1884d1d92667cc502ad20758b084a12 diff --git a/src/apple_sensors.c b/src/apple_sensors.c index d15bec42..f78c3da2 100644 --- a/src/apple_sensors.c +++ b/src/apple_sensors.c @@ -29,10 +29,6 @@ #include "common.h" #include "plugin.h" -#if HAVE_CTYPE_H -#include -#endif - #if HAVE_MACH_MACH_TYPES_H #include #endif @@ -69,25 +65,18 @@ static int as_init(void) { if (status != kIOReturnSuccess) { ERROR("IOMasterPort failed: %s", mach_error_string(status)); io_master_port = MACH_PORT_NULL; - return (-1); + return -1; } - return (0); + return 0; } static void as_submit(const char *type, const char *type_instance, double val) { - value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - DEBUG("type = %s; type_instance = %s; val = %f;", type, type_instance, val); - - values[0].gauge = val; - - vl.values = values; + vl.values = &(value_t){.gauge = val}; vl.values_len = 1; - sstrncpy(vl.host, hostname_g, sizeof(vl.host)); sstrncpy(vl.plugin, "apple_sensors", sizeof(vl.plugin)); - sstrncpy(vl.plugin_instance, "", sizeof(vl.plugin_instance)); sstrncpy(vl.type, type, sizeof(vl.type)); sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance)); @@ -106,13 +95,13 @@ static int as_read(void) { int value_int; double value_double; if (!io_master_port || (io_master_port == MACH_PORT_NULL)) - return (-1); + return -1; status = IOServiceGetMatchingServices( io_master_port, IOServiceNameMatching("IOHWSensor"), &iterator); if (status != kIOReturnSuccess) { ERROR("IOServiceGetMatchingServices failed: %s", mach_error_string(status)); - return (-1); + return -1; } while ((io_obj = IOIteratorNext(iterator))) { @@ -195,7 +184,7 @@ static int as_read(void) { IOObjectRelease(iterator); - return (0); + return 0; } /* int as_read */ void module_register(void) {