diff options
author | Vladimir Kobal <vlad@prokk.net> | 2017-10-13 16:51:45 +0300 |
---|---|---|
committer | Vladimir Kobal <vlad@prokk.net> | 2017-10-13 16:51:45 +0300 |
commit | 28fe0f119e48ca7adf2323af3befa9327d4396aa (patch) | |
tree | 659e3af9a884d9b2db5697b15e59a328f5309fb3 | |
parent | 584e7f6b9af433ad2d2033cd2406a80a12fafc7f (diff) |
Fix macOS versions for #ifdefs
-rw-r--r-- | src/common.c | 6 | ||||
-rw-r--r-- | src/macos_mach_smi.c | 14 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/common.c b/src/common.c index 5a953672d0..ac6ad8ce30 100644 --- a/src/common.c +++ b/src/common.c @@ -1119,10 +1119,14 @@ pid_t gettid(void) { #ifdef __FreeBSD__ return (pid_t)pthread_getthreadid_np(); #elif defined(__APPLE__) +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) uint64_t curthreadid; pthread_threadid_np(NULL, &curthreadid); return (pid_t)curthreadid; -#else +#else /* __MAC_OS_X_VERSION_MIN_REQUIRED */ + return (pid_t)pthread_self; +#endif /* __MAC_OS_X_VERSION_MIN_REQUIRED */ +#else /* __APPLE__*/ return (pid_t)syscall(SYS_gettid); #endif /* __FreeBSD__, __APPLE__*/ } diff --git a/src/macos_mach_smi.c b/src/macos_mach_smi.c index 9249c29734..9e1e8b3bf0 100644 --- a/src/macos_mach_smi.c +++ b/src/macos_mach_smi.c @@ -25,7 +25,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) { natural_t cp_time[CPU_STATE_MAX]; // NEEDED BY: do_ram, do_swapio, do_pgfaults -#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED > 1050) +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) vm_statistics64_data_t vm_statistics; #else vm_statistics_data_t vm_statistics; @@ -77,7 +77,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) { // -------------------------------------------------------------------- if (likely(do_ram || do_swapio || do_pgfaults)) { -#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED > 1050) +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060) count = sizeof(vm_statistics64_data_t); kr = host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm_statistics, &count); #else @@ -101,7 +101,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) { rrddim_add(st, "active", NULL, system_pagesize, 1048576, RRD_ALGORITHM_ABSOLUTE); rrddim_add(st, "wired", NULL, system_pagesize, 1048576, RRD_ALGORITHM_ABSOLUTE); -#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080) +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) rrddim_add(st, "throttled", NULL, system_pagesize, 1048576, RRD_ALGORITHM_ABSOLUTE); rrddim_add(st, "compressor", NULL, system_pagesize, 1048576, RRD_ALGORITHM_ABSOLUTE); #endif @@ -114,7 +114,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) { rrddim_set(st, "active", vm_statistics.active_count); rrddim_set(st, "wired", vm_statistics.wire_count); -#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080) +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) rrddim_set(st, "throttled", vm_statistics.throttled_count); rrddim_set(st, "compressor", vm_statistics.compressor_page_count); #endif @@ -125,7 +125,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) { rrdset_done(st); } -#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080) +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) // -------------------------------------------------------------------- if (likely(do_swapio)) { @@ -158,7 +158,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) { rrddim_add(st, "cow", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_add(st, "pagein", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_add(st, "pageout", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); -#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080) +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) rrddim_add(st, "compress", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_add(st, "decompress", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); #endif @@ -172,7 +172,7 @@ int do_macos_mach_smi(int update_every, usec_t dt) { rrddim_set(st, "cow", vm_statistics.cow_faults); rrddim_set(st, "pagein", vm_statistics.pageins); rrddim_set(st, "pageout", vm_statistics.pageouts); -#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080) +#if (defined __MAC_OS_X_VERSION_MIN_REQUIRED && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) rrddim_set(st, "compress", vm_statistics.compressions); rrddim_set(st, "decompress", vm_statistics.decompressions); #endif |