--- src/collectors/macos.plugin/macos_power.c 2026-07-15 20:55:09.000000000 +0800 +++ src/collectors/macos.plugin/macos_power.c 2026-08-01 08:43:01.000000000 +0800 @@ -11,6 +11,10 @@ #include #include +#ifndef kIOPSTemperatureKey +#define kIOPSTemperatureKey "Temperature" +#endif + #define MACOS_POWER_SOURCE_NAME_MAX 128 struct macos_power_source { --- src/collectors/macos.plugin/macos_smc.c 2026-07-15 20:55:09.000000000 +0800 +++ src/collectors/macos.plugin/macos_smc.c 2026-08-01 08:48:26.000000000 +0800 @@ -6,6 +6,10 @@ #include #include +#ifndef kIOMainPortDefault +#define kIOMainPortDefault kIOMasterPortDefault +#endif + struct macos_smc_key_data_ver { uint8_t major; uint8_t minor; --- src/collectors/macos.plugin/macos_gpu.c 2026-07-15 20:55:09.000000000 +0800 +++ src/collectors/macos.plugin/macos_gpu.c 2026-08-01 08:50:09.000000000 +0800 @@ -13,6 +13,10 @@ #include #include +#ifndef kIOMainPortDefault +#define kIOMainPortDefault kIOMasterPortDefault +#endif + #define MACOS_GPU_DVFS_KEY "voltage-states9" #define MACOS_GPU_DVFS_SCALE_HZ_PER_MHZ 1000000.0 #define MACOS_GPU_MAX_DVFS_STATES 64 --- src/collectors/macos.plugin/plugin_macos.c 2026-07-15 20:55:09.000000000 +0800 +++ src/collectors/macos.plugin/plugin_macos.c 2026-08-01 08:59:02.000000000 +0800 @@ -20,7 +20,6 @@ {.name = "gpu", .dim = "gpu", .enabled = 1, .func = do_macos_gpu}, {.name = "sensors", .dim = "sensors", .enabled = 1, .func = do_macos_sensors}, {.name = "powermetrics", .dim = "pwrmet", .enabled = 1, .func = do_macos_powermetrics}, - {.name = "nvme smart", .dim = "nvme", .enabled = 1, .func = do_macos_nvme_smart}, // the terminator of this array {.name = NULL, .dim = NULL, .enabled = 0, .func = NULL} @@ -41,7 +40,6 @@ macos_gpu_cleanup(); macos_sensors_cleanup(); macos_powermetrics_cleanup(); - macos_nvme_smart_cleanup(); macos_power_sources_cleanup(); worker_unregister(); --- src/collectors/macos.plugin/plugin_macos.h 2026-07-15 20:55:09.000000000 +0800 +++ src/collectors/macos.plugin/plugin_macos.h 2026-08-01 08:58:19.000000000 +0800 @@ -12,7 +12,6 @@ int do_macos_gpu(int update_every, usec_t dt); int do_macos_sensors(int update_every, usec_t dt); int do_macos_powermetrics(int update_every, usec_t dt); -int do_macos_nvme_smart(int update_every, usec_t dt); bool macos_gpu_power_available(void); bool macos_gpu_power_source_available(void); @@ -25,7 +24,6 @@ void macos_gpu_cleanup(void); void macos_sensors_cleanup(void); void macos_powermetrics_cleanup(void); -void macos_nvme_smart_cleanup(void); void macos_power_sources_cleanup(void); #endif /* NETDATA_PLUGIN_MACOS_H */ --- CMakeLists.txt 2026-07-15 20:55:09.000000000 +0800 +++ CMakeLists.txt 2026-08-01 09:01:05.000000000 +0800 @@ -1973,7 +1973,6 @@ src/collectors/macos.plugin/macos_gpu.c src/collectors/macos.plugin/macos_sensors.c src/collectors/macos.plugin/macos_powermetrics.c - src/collectors/macos.plugin/macos_nvme.c ) set(FREEBSD_PLUGIN_FILES --- src/collectors/macos.plugin/macos_iohid.c 2026-07-15 20:55:09.000000000 +0800 +++ src/collectors/macos.plugin/macos_iohid.c 2026-08-01 09:49:00.000000000 +0800 @@ -2,151 +2,36 @@ #include "macos_iohid.h" -typedef struct __IOHIDEvent *IOHIDEventRef; - -extern IOHIDEventSystemClientRef IOHIDEventSystemClientCreate(CFAllocatorRef allocator); -extern void IOHIDEventSystemClientSetMatching(IOHIDEventSystemClientRef client, CFDictionaryRef matching); -extern CFArrayRef IOHIDEventSystemClientCopyServices(IOHIDEventSystemClientRef client); -extern CFTypeRef IOHIDServiceClientCopyProperty(IOHIDServiceClientRef service, CFStringRef key); -extern CFTypeRef IOHIDServiceClientGetRegistryID(IOHIDServiceClientRef service); -extern IOHIDEventRef IOHIDServiceClientCopyEvent( - IOHIDServiceClientRef service, - int64_t type, - int32_t options, - int64_t timestamp); -extern double IOHIDEventGetFloatValue(IOHIDEventRef event, int32_t field); - -static void macos_iohid_client_invalidate(struct macos_iohid_client *hid) -{ - if (!hid) - return; - - if (!hid->client) - return; - - CFRelease(hid->client); - hid->client = NULL; -} - -static CFNumberRef macos_iohid_cfnumber_int(int value) -{ - return CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &value); -} - -static bool macos_iohid_matching_create(struct macos_iohid_client *hid, int primary_usage_page, int primary_usage) -{ - CFStringRef keys[] = {CFSTR("PrimaryUsagePage"), CFSTR("PrimaryUsage")}; - CFNumberRef values[] = { - macos_iohid_cfnumber_int(primary_usage_page), - macos_iohid_cfnumber_int(primary_usage), - }; - if (!values[0] || !values[1]) { - if (values[0]) - CFRelease(values[0]); - if (values[1]) - CFRelease(values[1]); - return false; - } - - CFDictionaryRef matching = CFDictionaryCreate( - kCFAllocatorDefault, - (const void **)keys, - (const void **)values, - 2, - &kCFTypeDictionaryKeyCallBacks, - &kCFTypeDictionaryValueCallBacks); - - CFRelease(values[0]); - CFRelease(values[1]); - - if (!matching) - return false; - - hid->matching = matching; - hid->primary_usage_page = primary_usage_page; - hid->primary_usage = primary_usage; - hid->matching_configured = true; - return true; -} - bool macos_iohid_client_set_matching( struct macos_iohid_client *hid, int primary_usage_page, int primary_usage) { - if (!hid) - return false; - - if (hid->matching_configured && - hid->primary_usage_page == primary_usage_page && - hid->primary_usage == primary_usage) - return true; - - macos_iohid_client_invalidate(hid); - - if (hid->matching) { - CFRelease(hid->matching); - hid->matching = NULL; - } - - hid->matching_configured = false; - return macos_iohid_matching_create(hid, primary_usage_page, primary_usage); + (void)hid; (void)primary_usage_page; (void)primary_usage; + return false; } CFArrayRef macos_iohid_client_copy_services(struct macos_iohid_client *hid) { - if (!hid || !hid->matching_configured || !hid->matching) - return NULL; - - if (!hid->client) { - hid->client = IOHIDEventSystemClientCreate(kCFAllocatorDefault); - if (!hid->client) - return NULL; - - // Private API return semantics are not stable; CopyServices validates the configured client. - IOHIDEventSystemClientSetMatching(hid->client, hid->matching); - } - - CFArrayRef services = IOHIDEventSystemClientCopyServices(hid->client); - if (!services) { - macos_iohid_client_invalidate(hid); - return NULL; - } - - return services; + (void)hid; + return NULL; } void macos_iohid_client_cleanup(struct macos_iohid_client *hid) { - if (!hid) - return; - - macos_iohid_client_invalidate(hid); - - if (hid->matching) { - CFRelease(hid->matching); - hid->matching = NULL; - } - - hid->primary_usage_page = 0; - hid->primary_usage = 0; - hid->matching_configured = false; + (void)hid; } CFTypeRef macos_iohid_service_copy_property(IOHIDServiceClientRef service, CFStringRef key) { - if (!service || !key) - return NULL; - - return IOHIDServiceClientCopyProperty(service, key); + (void)service; (void)key; + return NULL; } CFTypeRef macos_iohid_service_get_registry_id(IOHIDServiceClientRef service) { - if (!service) - return NULL; - - return IOHIDServiceClientGetRegistryID(service); + (void)service; + return NULL; } bool macos_iohid_service_copy_event_float( @@ -155,14 +40,6 @@ int32_t field, NETDATA_DOUBLE *value) { - if (!service || !value) - return false; - - IOHIDEventRef event = IOHIDServiceClientCopyEvent(service, type, 0, 0); - if (!event) - return false; - - *value = IOHIDEventGetFloatValue(event, field); - CFRelease(event); - return true; + (void)service; (void)type; (void)field; (void)value; + return false; }