summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 15e541d)
raw | patch | inline | side by side (parent: 15e541d)
author | Florian Forster <octo@huhu.verplant.org> | |
Tue, 22 May 2007 15:53:23 +0000 (17:53 +0200) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Tue, 22 May 2007 15:53:23 +0000 (17:53 +0200) |
Take this into account and don't report all processes without tasks as zombies.
src/processes.c | patch | blob | history |
diff --git a/src/processes.c b/src/processes.c
index 68984458058df5e69769662b7086833867d22c00..ccf1571f8ea6211e32defc2418a43212dff7826d 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
ppid = atoi (fields[3]);
- if ((tasks = ps_read_tasks (pid)) == NULL)
- {
- /* This happends for zombied, e.g. */
- DBG ("ps_read_tasks (%i) failed.", pid);
- *state = 'Z';
- ps->num_lwp = 0;
- ps->num_proc = 0;
- }
+ *state = fields[2][0];
+
+ if (*state == 'Z')
+ {
+ ps->num_lwp = 0;
+ ps->num_proc = 0;
+ }
+ else if ((tasks = ps_read_tasks (pid)) == NULL)
+ {
+ /* Kernel 2.4 or so */
+ ps->num_lwp = 1;
+ ps->num_proc = 1;
+ }
else
{
- *state = '\0';
ps->num_lwp = 0;
ps->num_proc = 1;
for (i = 0; tasks[i] != 0; i++)
tasks = NULL;
}
- /* Leave the rest at zero if this is only an LWP */
+ /* Leave the rest at zero if this is only a zombi */
if (ps->num_proc == 0)
{
- DBG ("This is only an LWP: pid = %i; name = %s;",
+ DBG ("This is only a zombi: pid = %i; name = %s;",
pid, ps->name);
return (0);
}
ps->cpu_system_counter = (unsigned long) cpu_system_counter;
ps->vmem_rss = (unsigned long) vmem_rss;
- *state = fields[2][0];
-
/* success */
return (0);
} /* int ps_read_process (...) */