diff --git a/src/glx/apple/apple_glx_log.c b/src/glx/apple/apple_glx_log.c index e50ec966484fe6193270033693c43c81a3cf390e..4ea89bdfb3fefc7b8a037ea46195c23a475d33fd 100644 --- src/glx/apple/apple_glx_log.c +++ src/glx/apple/apple_glx_log.c @@ -73,7 +73,7 @@ void _apple_glx_vlog(int level, const char *file, const char *function, uint64_t thread = 0; if (pthread_is_threaded_np()) { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 +#if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 || defined(__POWERPC__) thread = (uint64_t)(uintptr_t)pthread_self(); #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060 if (&pthread_threadid_np) { diff --git a/src/util/os_misc.c b/src/util/os_misc.c index 4b7916634b3a828fa5d78dbe3d62107dec6e5981..3a318c5058db956b0747d55b026f27ac96e449c6 100644 --- src/util/os_misc.c +++ src/util/os_misc.c @@ -390,12 +390,21 @@ os_get_available_system_memory(uint64_t *size) *size = status.ullAvailPhys; return (ret == true); #elif DETECT_OS_APPLE +# if defined(__i386__) || defined(__ppc__) + vm_statistics_data_t vm_stats; + mach_msg_type_number_t count = HOST_VM_INFO_COUNT; + if (host_statistics(mach_host_self(), HOST_VM_INFO, + (host_info_t)&vm_stats, &count) != KERN_SUCCESS) { + return false; + } +# else vm_statistics64_data_t vm_stats; mach_msg_type_number_t count = HOST_VM_INFO64_COUNT; if (host_statistics64(mach_host_self(), HOST_VM_INFO, (host_info64_t)&vm_stats, &count) != KERN_SUCCESS) { return false; } +# endif *size = ((uint64_t)vm_stats.free_count + (uint64_t)vm_stats.inactive_count) * PAGE_SIZE; return true;