Process Hacker displays this information.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v2: Implement on the client side.
dlls/ntdll/unix/process.c | 19 +++++++++++++------ dlls/ntdll/unix/system.c | 1 + dlls/ntdll/unix/unix_private.h | 1 + 3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/dlls/ntdll/unix/process.c b/dlls/ntdll/unix/process.c index 7061d8864db..0dc46284b03 100644 --- a/dlls/ntdll/unix/process.c +++ b/dlls/ntdll/unix/process.c @@ -1002,10 +1002,13 @@ NTSTATUS WINAPI NtTerminateProcess( HANDLE handle, LONG exit_code )
#if defined(HAVE_MACH_MACH_H)
-static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) +void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) { #if defined(MACH_TASK_BASIC_INFO) struct mach_task_basic_info info; + + if (unix_pid != -1) return; /* FIXME: Retrieve information for other processes. */ + 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) { @@ -1019,13 +1022,17 @@ static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi )
#elif defined(linux)
-static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) +void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) { FILE *f; - char line[256]; + char line[256], path[26]; unsigned long value;
- f = fopen("/proc/self/status", "r"); + if (unix_pid == -1) + strcpy( path, "/proc/self/status" ); + else + sprintf( path, "/proc/%u/status", unix_pid); + f = fopen( path, "r" ); if (!f) return;
while (fgets(line, sizeof(line), f)) @@ -1050,7 +1057,7 @@ static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi )
#else
-static void fill_VM_COUNTERS( VM_COUNTERS_EX *pvmi ) +void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) { /* FIXME : real data */ } @@ -1171,7 +1178,7 @@ NTSTATUS WINAPI NtQueryInformationProcess( HANDLE handle, PROCESSINFOCLASS class else { memset(&pvmi, 0, sizeof(pvmi)); - if (handle == GetCurrentProcess()) fill_VM_COUNTERS(&pvmi); + if (handle == GetCurrentProcess()) fill_vm_counters( &pvmi, -1 ); else { SERVER_START_REQ(get_process_vm_counters) diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c index a80d3c4fd4a..33fb37ec33d 100644 --- a/dlls/ntdll/unix/system.c +++ b/dlls/ntdll/unix/system.c @@ -2147,6 +2147,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class, nt_process->ParentProcessId = UlongToHandle(server_process->parent_pid); nt_process->HandleCount = server_process->handle_count; get_thread_times( server_process->unix_pid, -1, &nt_process->KernelTime, &nt_process->UserTime ); + fill_vm_counters( &nt_process->vmCounters, server_process->unix_pid ); }
pos = (pos + 7) & ~7; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h index 82806463e53..6dfc866479d 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -224,6 +224,7 @@ extern void DECLSPEC_NORETURN signal_start_thread( PRTL_THREAD_START_ROUTINE ent BOOL suspend, void *relay, TEB *teb ) DECLSPEC_HIDDEN; extern void DECLSPEC_NORETURN signal_exit_thread( int status, void (*func)(int) ) DECLSPEC_HIDDEN; extern void __wine_syscall_dispatcher(void) DECLSPEC_HIDDEN; +extern void fill_vm_counters( VM_COUNTERS_EX *pvmi, int unix_pid ) DECLSPEC_HIDDEN;
extern NTSTATUS cdrom_DeviceIoControl( HANDLE device, HANDLE event, PIO_APC_ROUTINE apc, void *apc_user, IO_STATUS_BLOCK *io, ULONG code, void *in_buffer,