Merge branch 'collectd-4.5' into collectd-4.6
[collectd.git] / src / processes.c
index 0d670f5..559ba97 100644 (file)
@@ -1,8 +1,9 @@
 /**
  * collectd - src/processes.c
- * Copyright (C) 2005  Lyonel Vincent
- * Copyright (C) 2006-2008  Florian Forster (Mach code)
- * Copyright (C) 2008  Oleg King
+ * Copyright (C) 2005       Lyonel Vincent
+ * Copyright (C) 2006-2008  Florian octo Forster
+ * Copyright (C) 2008       Oleg King
+ * Copyright (C) 2009       Sebastian Harl
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
 # include <regex.h>
 #endif
 
+#ifndef ARG_MAX
+#  define ARG_MAX 4096
+#endif
+
 #define BUFSIZE 256
 
 static const char *config_keys[] =
@@ -549,7 +554,6 @@ static void ps_submit_state (const char *state, double value)
 
        vl.values = values;
        vl.values_len = 1;
-       vl.time = time (NULL);
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "processes", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));
@@ -567,7 +571,6 @@ static void ps_submit_proc_list (procstat_t *ps)
 
        vl.values = values;
        vl.values_len = 2;
-       vl.time = time (NULL);
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "processes", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, ps->name, sizeof (vl.plugin_instance));
@@ -819,7 +822,7 @@ static char *ps_get_cmdline (pid_t pid, char *name, char *buf, size_t buf_len)
        n = 0;
 
        while (42) {
-               size_t status;
+               ssize_t status;
 
                status = read (fd, (void *)buf_ptr, len);
 
@@ -1355,7 +1358,9 @@ static int ps_read (void)
                pse.num_proc = 1;
                pse.num_lwp  = procs[i].ki_numthreads;
 
+               /* pse.vmem_size = procs[i].ki_size; */
                pse.vmem_rss = procs[i].ki_rssize * getpagesize();
+               /* pse.stack_size = procs[i].ki_ssize * getpagesize(); */
                pse.vmem_minflt = 0;
                pse.vmem_minflt_counter = procs[i].ki_rusage.ru_minflt;
                pse.vmem_majflt = 0;