X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fprocesses.c;h=4e0aa7833f0af316fed4b4586b051c49f361b5f2;hb=3489284330462f4edc85a75445a5cc8014e29db0;hp=9ae48dbd741adff2d7bb9fef10babb2682e3d8c4;hpb=30eeeee996124de666f907877f8196e5580101ed;p=collectd.git diff --git a/src/processes.c b/src/processes.c index 9ae48dbd..4e0aa783 100644 --- a/src/processes.c +++ b/src/processes.c @@ -897,33 +897,6 @@ static procstat_t *ps_read_tasks_status (int pid, procstat_t *ps) return (ps); } /* int *ps_read_tasks_status */ -static int ps_read_tasks (int pid) -{ - char dirname[64]; - DIR *dh; - struct dirent *ent; - int count = 0; - - ssnprintf (dirname, sizeof (dirname), "/proc/%i/task", pid); - - if ((dh = opendir (dirname)) == NULL) - { - DEBUG ("Failed to open directory `%s'", dirname); - return (-1); - } - - while ((ent = readdir (dh)) != NULL) - { - if (!isdigit ((int) ent->d_name[0])) - continue; - else - count++; - } - closedir (dh); - - return ((count >= 1) ? count : 1); -} /* int *ps_read_tasks */ - /* Read data from /proc/pid/status */ static procstat_t *ps_read_status (int pid, procstat_t *ps) { @@ -1876,6 +1849,7 @@ static int ps_read (void) continue; } + memset (&pse, 0, sizeof (pse)); pse.id = pid; pse.age = 0; @@ -2153,6 +2127,7 @@ static int ps_read (void) } } /* if (process has argument list) */ + memset (&pse, 0, sizeof (pse)); pse.id = procs[i].p_pid; pse.age = 0; @@ -2182,6 +2157,9 @@ static int ps_read (void) pse.io_syscr = -1; pse.io_syscw = -1; + pse.cswitch_vol = -1; + pse.cswitch_invol = -1; + ps_list_add (procs[i].p_comm, have_cmdline ? cmdline : NULL, &pse); } /* if ((proc_ptr == NULL) || (proc_ptr->p_pid != procs[i].p_pid)) */ @@ -2397,6 +2375,7 @@ static int ps_read (void) continue; } + memset (&pse, 0, sizeof (pse)); pse.id = pid; pse.age = 0; @@ -2423,6 +2402,9 @@ static int ps_read (void) pse.io_syscr = ps.io_syscr; pse.io_syscw = ps.io_syscw; + pse.cswitch_vol = -1; + pse.cswitch_invol = -1; + switch (state) { case 'R': running++; break;