projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cpu, interface plugin: Fix compilation issues under Solaris.
[collectd.git]
/
src
/
processes.c
diff --git
a/src/processes.c
b/src/processes.c
index
5a29236
..
ff40126
100644
(file)
--- a/
src/processes.c
+++ b/
src/processes.c
@@
-584,17
+584,21
@@
int ps_read_process (int pid, procstat_t *ps, char *state)
ppid = atoi (fields[3]);
ppid = atoi (fields[3]);
- if ((tasks = ps_read_tasks (pid)) == NULL)
+ *state = fields[2][0];
+
+ if (*state == 'Z')
{
{
- /* This happends for zombied, e.g. */
- DEBUG ("ps_read_tasks (%i) failed.", pid);
- *state = 'Z';
ps->num_lwp = 0;
ps->num_proc = 0;
}
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
{
else
{
- *state = '\0';
ps->num_lwp = 0;
ps->num_proc = 1;
for (i = 0; tasks[i] != 0; i++)
ps->num_lwp = 0;
ps->num_proc = 1;
for (i = 0; tasks[i] != 0; i++)
@@
-604,10
+608,10
@@
int ps_read_process (int pid, procstat_t *ps, char *state)
tasks = NULL;
}
tasks = NULL;
}
- /* Leave the rest at zero if this is only a
n LWP
*/
+ /* Leave the rest at zero if this is only a
zombi
*/
if (ps->num_proc == 0)
{
if (ps->num_proc == 0)
{
- DEBUG ("This is only a
n LWP
: pid = %i; name = %s;",
+ DEBUG ("This is only a
zombi
: pid = %i; name = %s;",
pid, ps->name);
return (0);
}
pid, ps->name);
return (0);
}
@@
-627,8
+631,6
@@
int ps_read_process (int pid, procstat_t *ps, char *state)
ps->cpu_system_counter = (unsigned long) cpu_system_counter;
ps->vmem_rss = (unsigned long) vmem_rss;
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 (...) */
/* success */
return (0);
} /* int ps_read_process (...) */