summaryrefslogtreecommitdiffstats
path: root/collectors/macos.plugin
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2022-02-21 12:23:48 +0200
committerGitHub <noreply@github.com>2022-02-21 12:23:48 +0200
commitd8b7b6a25f7fc0ec4d79a7f8a72c779e3bf4afd7 (patch)
tree8fba2db960467dcbbd3cba0660d1a874c16783db /collectors/macos.plugin
parentad72a83afdd5fbd1075d1d1f3cc97edfdea4650e (diff)
Fix compilation warnings on macOS (#12082)
Diffstat (limited to 'collectors/macos.plugin')
-rw-r--r--collectors/macos.plugin/macos_fw.c13
-rw-r--r--collectors/macos.plugin/macos_sysctl.c7
2 files changed, 10 insertions, 10 deletions
diff --git a/collectors/macos.plugin/macos_fw.c b/collectors/macos.plugin/macos_fw.c
index 1fa2d39c85..492490576f 100644
--- a/collectors/macos.plugin/macos_fw.c
+++ b/collectors/macos.plugin/macos_fw.c
@@ -35,7 +35,7 @@ int do_macos_iokit(int update_every, usec_t dt) {
RRDSET *st;
- mach_port_t master_port;
+ mach_port_t main_port;
io_registry_entry_t drive, drive_media;
io_iterator_t drive_list;
CFDictionaryRef properties, statistics;
@@ -73,19 +73,22 @@ int do_macos_iokit(int update_every, usec_t dt) {
// NEEDED BY: do_space, do_inodes
struct statfs *mntbuf;
int mntsize, i;
- char mntonname[MNAMELEN + 1];
char title[4096 + 1];
// NEEDED BY: do_bandwidth
struct ifaddrs *ifa, *ifap;
+#if !__is_identifier(IOMainPort) /* macOS >= 12.0 */
+#define IOMainPort IOMasterPort
+#endif
+
/* Get ports and services for drive statistics. */
- if (unlikely(IOMasterPort(bootstrap_port, &master_port))) {
+ if (unlikely(IOMainPort(bootstrap_port, &main_port))) {
error("MACOS: IOMasterPort() failed");
do_io = 0;
error("DISABLED: system.io");
/* Get the list of all drive objects. */
- } else if (unlikely(IOServiceGetMatchingServices(master_port, IOServiceMatching("IOBlockStorageDriver"), &drive_list))) {
+ } else if (unlikely(IOServiceGetMatchingServices(main_port, IOServiceMatching("IOBlockStorageDriver"), &drive_list))) {
error("MACOS: IOServiceGetMatchingServices() failed");
do_io = 0;
error("DISABLED: system.io");
@@ -115,7 +118,7 @@ int do_macos_iokit(int update_every, usec_t dt) {
CFRelease(properties);
IOObjectRelease(drive_media);
- if(unlikely(!diskstat.name || !*diskstat.name)) {
+ if(unlikely(!*diskstat.name)) {
IOObjectRelease(drive);
continue;
}
diff --git a/collectors/macos.plugin/macos_sysctl.c b/collectors/macos.plugin/macos_sysctl.c
index b744ebbcc0..34d3f0b3e4 100644
--- a/collectors/macos.plugin/macos_sysctl.c
+++ b/collectors/macos.plugin/macos_sysctl.c
@@ -70,11 +70,9 @@ int do_macos_sysctl(int update_every, usec_t dt) {
do_uptime = config_get_boolean("plugin:macos:sysctl", "system uptime", 1);
}
- RRDSET *st;
+ RRDSET *st = NULL;
- int system_pagesize = getpagesize(); // wouldn't it be better to get value directly from hw.pagesize?
- int i, n;
- int common_error = 0;
+ int i;
size_t size;
// NEEDED BY: do_loadavg
@@ -96,7 +94,6 @@ int do_macos_sysctl(int update_every, usec_t dt) {
// NEEDED BY: do_tcp...
struct tcpstat tcpstat;
- uint64_t tcps_states[TCP_NSTATES];
// NEEDED BY: do_udp...
struct udpstat udpstat;