* fhandler_process.cc (format_process_status): Always print process name
even for zombies. (get_mem_values): Fix loop fetching working set list to avoid out of memory conditions. Return all mem values set to 0 for zombies. * ntdll.h (STATUS_PROCESS_IS_TERMINATING): Define.
This commit is contained in:
parent
69f8cb36d3
commit
d10f0e106e
|
@ -1,3 +1,11 @@
|
|||
2011-08-10 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler_process.cc (format_process_status): Always print process name
|
||||
even for zombies.
|
||||
(get_mem_values): Fix loop fetching working set list to avoid out of
|
||||
memory conditions. Return all mem values set to 0 for zombies.
|
||||
* ntdll.h (STATUS_PROCESS_IS_TERMINATING): Define.
|
||||
|
||||
2011-08-09 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* heap.cc (eval_initial_heap_size): New function fetching the heap
|
||||
|
|
|
@ -1135,10 +1135,6 @@ format_process_status (void *data, char *&destbuf)
|
|||
const char *state_str = "unknown";
|
||||
unsigned long vmsize = 0UL, vmrss = 0UL, vmdata = 0UL, vmlib = 0UL, vmtext = 0UL,
|
||||
vmshare = 0UL;
|
||||
if (p->process_state & PID_EXITED)
|
||||
strcpy (cmd, "<defunct>");
|
||||
else
|
||||
{
|
||||
PWCHAR last_slash = wcsrchr (p->progname, L'\\');
|
||||
wcscpy (wcmd, last_slash ? last_slash + 1 : p->progname);
|
||||
sys_wcstombs (cmd, NAME_MAX + 1, wcmd);
|
||||
|
@ -1149,7 +1145,6 @@ format_process_status (void *data, char *&destbuf)
|
|||
if (ascii_strcasematch (s, ".exe"))
|
||||
*s = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Note: under Windows, a _process_ is always running - it's only _threads_
|
||||
* that get suspended. Therefore the default state is R (runnable).
|
||||
|
@ -1370,14 +1365,12 @@ get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss,
|
|||
debug_printf ("OpenProcess, %E");
|
||||
return false;
|
||||
}
|
||||
do
|
||||
while (true)
|
||||
{
|
||||
ret = NtQueryVirtualMemory (hProcess, 0, MemoryWorkingSetList,
|
||||
(PVOID) p, n, (length = ULONG_MAX, &length));
|
||||
if (ret == STATUS_INFO_LENGTH_MISMATCH
|
||||
|| (!NT_SUCCESS (ret) && length > n))
|
||||
{
|
||||
ret = STATUS_INFO_LENGTH_MISMATCH;
|
||||
if (ret != STATUS_INFO_LENGTH_MISMATCH)
|
||||
break;
|
||||
n <<= 1;
|
||||
PMEMORY_WORKING_SET_LIST new_p = (PMEMORY_WORKING_SET_LIST)
|
||||
realloc (p, n);
|
||||
|
@ -1385,11 +1378,15 @@ get_mem_values (DWORD dwProcessId, unsigned long *vmsize, unsigned long *vmrss,
|
|||
goto out;
|
||||
p = new_p;
|
||||
}
|
||||
}
|
||||
while (!NT_SUCCESS (ret));
|
||||
if (!NT_SUCCESS (ret))
|
||||
{
|
||||
debug_printf ("NtQueryVirtualMemory: ret %p", ret);
|
||||
if (ret == STATUS_PROCESS_IS_TERMINATING)
|
||||
{
|
||||
*vmsize = *vmrss = *vmtext = *vmdata = *vmlib = *vmshare = 0;
|
||||
res = true;
|
||||
}
|
||||
else
|
||||
__seterrno_from_nt_status (ret);
|
||||
goto out;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#define STATUS_INVALID_NETWORK_RESPONSE ((NTSTATUS) 0xc00000c3)
|
||||
#define STATUS_BAD_NETWORK_NAME ((NTSTATUS) 0xc00000cc)
|
||||
#define STATUS_DIRECTORY_NOT_EMPTY ((NTSTATUS) 0xc0000101)
|
||||
#define STATUS_PROCESS_IS_TERMINATING ((NTSTATUS) 0xc000010a)
|
||||
#define STATUS_CANNOT_DELETE ((NTSTATUS) 0xc0000121)
|
||||
#define STATUS_INVALID_LEVEL ((NTSTATUS) 0xc0000148)
|
||||
#define STATUS_DLL_NOT_FOUND ((NTSTATUS) 0xc0000135)
|
||||
|
|
Loading…
Reference in New Issue