@cryptotaxi247 / netdata-1 / commits / 32a2de41b

add backwards compatibility for mac OSX < 10.11

Michael Krause committed Oct 5, 2017 at 10:03 UTC 32a2de41ba22fce782f3c9bc8f44afa0086be7b8
1 file changed +16
src/macos_sysctl.c
+16
@@ -1,4 +1,5 @@
1 #include "common.h"
2 +#include <Availability.h>
3 #include <sys/sysctl.h>
4 // NEEDED BY: do_bandwidth
5 #include <net/route.h>
@@ -112,9 +113,21 @@ int do_macos_sysctl(int update_every, usec_t dt) {
113 /*
114 * Dirty workaround for /usr/include/netinet6/ip6_var.h absence.
115 * Struct ip6stat was copied from bsd/netinet6/ip6_var.h from xnu sources.
116 + * Do the same for previously missing scope6_var.h on OS X < 10.11.
117 */
118 #define IP6S_SRCRULE_COUNT 16
119 +
120 +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED < 101100)
121 +#ifndef _NETINET6_SCOPE6_VAR_H_
122 +#define _NETINET6_SCOPE6_VAR_H_
123 +#include <sys/appleapiopts.h>
124 +
125 +#define SCOPE6_ID_MAX 16
126 +#endif
127 +#else
128 #include <netinet6/scope6_var.h>
129 +#endif
130 +
131 struct ip6stat {
132 u_quad_t ip6s_total; /* total packets received */
133 u_quad_t ip6s_tooshort; /* packet too short */
@@ -455,6 +468,8 @@ int do_macos_sysctl(int update_every, usec_t dt) {
468
469 // --------------------------------------------------------------------
470
471 +
472 +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
473 if (do_ecn == CONFIG_BOOLEAN_YES || (do_ecn == CONFIG_BOOLEAN_AUTO && (tcpstat.tcps_ecn_recv_ce || tcpstat.tcps_ecn_not_supported))) {
474 do_ecn = CONFIG_BOOLEAN_YES;
475 st = rrdset_find_localhost("ipv4.ecnpkts");
@@ -472,6 +487,7 @@ int do_macos_sysctl(int update_every, usec_t dt) {
487 rrddim_set(st, "InNoECTPkts", tcpstat.tcps_ecn_not_supported);
488 rrdset_done(st);
489 }
490 +#endif
491
492 }
493 }