kernel32: Fix build on older Mac OS X.
This commit is contained in:
parent
5395d23a7e
commit
a0d6c8c249
|
@ -1164,14 +1164,6 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
|
||||||
#ifdef VM_SWAPUSAGE
|
#ifdef VM_SWAPUSAGE
|
||||||
struct xsw_usage swap;
|
struct xsw_usage swap;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MACH_MACH_H
|
|
||||||
host_name_port_t host;
|
|
||||||
mach_msg_type_number_t count;
|
|
||||||
kern_return_t kr;
|
|
||||||
host_basic_info_data_t info;
|
|
||||||
vm_statistics64_data_t vm_stat;
|
|
||||||
vm_size_t page_size;
|
|
||||||
#endif
|
|
||||||
#elif defined(sun)
|
#elif defined(sun)
|
||||||
unsigned long pagesize,maxpages,freepages,swapspace,swapfree;
|
unsigned long pagesize,maxpages,freepages,swapspace,swapfree;
|
||||||
struct anoninfo swapinf;
|
struct anoninfo swapinf;
|
||||||
|
@ -1238,6 +1230,7 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
|
||||||
}
|
}
|
||||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||||
total = 0;
|
total = 0;
|
||||||
|
lpmemex->ullAvailPhys = 0;
|
||||||
|
|
||||||
mib[0] = CTL_HW;
|
mib[0] = CTL_HW;
|
||||||
#ifdef HW_MEMSIZE
|
#ifdef HW_MEMSIZE
|
||||||
|
@ -1248,22 +1241,29 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_MACH_MACH_H
|
#ifdef HAVE_MACH_MACH_H
|
||||||
host = mach_host_self();
|
{
|
||||||
|
host_name_port_t host = mach_host_self();
|
||||||
|
mach_msg_type_number_t count;
|
||||||
|
|
||||||
|
#ifdef HOST_VM_INFO64_COUNT
|
||||||
|
vm_size_t page_size;
|
||||||
|
vm_statistics64_data_t vm_stat;
|
||||||
|
|
||||||
|
count = HOST_VM_INFO64_COUNT;
|
||||||
|
if (host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm_stat, &count) == KERN_SUCCESS &&
|
||||||
|
host_page_size(host, &page_size == KERN_SUCCESS))
|
||||||
|
lpmemex->ullAvailPhys = (vm_stat.free_count + vm_stat.inactive_count) * (DWORDLONG)page_size;
|
||||||
|
#endif
|
||||||
if (!total)
|
if (!total)
|
||||||
{
|
{
|
||||||
|
host_basic_info_data_t info;
|
||||||
count = HOST_BASIC_INFO_COUNT;
|
count = HOST_BASIC_INFO_COUNT;
|
||||||
kr = host_info(host, HOST_BASIC_INFO, (host_info_t)&info, &count);
|
if (host_info(host, HOST_BASIC_INFO, (host_info_t)&info, &count) == KERN_SUCCESS)
|
||||||
if (kr == KERN_SUCCESS)
|
|
||||||
total = info.max_mem;
|
total = info.max_mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
count = HOST_VM_INFO64_COUNT;
|
|
||||||
kr = host_statistics64(host, HOST_VM_INFO64, (host_info64_t)&vm_stat, &count);
|
|
||||||
if (kr == KERN_SUCCESS)
|
|
||||||
kr = host_page_size(host, &page_size);
|
|
||||||
|
|
||||||
mach_port_deallocate(mach_task_self(), host);
|
mach_port_deallocate(mach_task_self(), host);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!total)
|
if (!total)
|
||||||
|
@ -1277,13 +1277,6 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
|
||||||
if (total)
|
if (total)
|
||||||
lpmemex->ullTotalPhys = total;
|
lpmemex->ullTotalPhys = total;
|
||||||
|
|
||||||
lpmemex->ullAvailPhys = 0;
|
|
||||||
|
|
||||||
#ifdef HAVE_MACH_MACH_H
|
|
||||||
if (kr == KERN_SUCCESS)
|
|
||||||
lpmemex->ullAvailPhys = (vm_stat.free_count + vm_stat.inactive_count) * (DWORDLONG)page_size;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!lpmemex->ullAvailPhys)
|
if (!lpmemex->ullAvailPhys)
|
||||||
{
|
{
|
||||||
mib[1] = HW_USERMEM;
|
mib[1] = HW_USERMEM;
|
||||||
|
|
Loading…
Reference in New Issue