Module: wine Branch: master Commit: 1f9fe124b2bd7e69dad5c90b7897380e32d43481 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1f9fe124b2bd7e69dad5c90b78...
Author: Snorri Sturluson snorri.sturluson@ccpgames.com Date: Thu Jan 28 17:22:10 2016 +0000
ntdll: Fill in memory counters under OS X.
Signed-off-by: Snorri Sturluson snorri.sturluson@ccpgames.com Signed-off-by: Ken Thomases ken@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/process.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index 5a5c3ef..a93b8fb 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -40,6 +40,10 @@ #include "ntdll_misc.h" #include "wine/server.h"
+#ifdef HAVE_MACH_MACH_H +#include <mach/mach.h> +#endif + WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
static ULONG execute_flags = MEM_EXECUTE_OPTION_DISABLE; @@ -110,6 +114,32 @@ ULONG_PTR get_system_affinity_mask(void) return ((ULONG_PTR)1 << num_cpus) - 1; }
+#if defined(HAVE_MACH_MACH_H) + +static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) +{ +#if defined(MACH_TASK_BASIC_INFO) + struct mach_task_basic_info info; + mach_msg_type_number_t infoCount = MACH_TASK_BASIC_INFO_COUNT; + if(task_info(mach_task_self(), MACH_TASK_BASIC_INFO, (task_info_t)&info, &infoCount) == KERN_SUCCESS) + { + pvmi->VirtualSize = info.resident_size + info.virtual_size; + pvmi->PagefileUsage = info.virtual_size; + pvmi->WorkingSetSize = info.resident_size; + pvmi->PeakWorkingSetSize = info.resident_size_max; + } +#endif +} + +#else + +static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) +{ + /* FIXME : real data */ +} + +#endif + /****************************************************************************** * NtQueryInformationProcess [NTDLL.@] * ZwQueryInformationProcess [NTDLL.@] @@ -240,8 +270,8 @@ NTSTATUS WINAPI NtQueryInformationProcess( ret = STATUS_INVALID_HANDLE; else { - /* FIXME : real data */ memset(&pvmi, 0 , sizeof(VM_COUNTERS)); + fill_VM_COUNTERS(&pvmi);
len = ProcessInformationLength; if (len != FIELD_OFFSET(VM_COUNTERS,PrivatePageCount)) len = sizeof(VM_COUNTERS);