projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #774 from trenkel/master
[collectd.git]
/
src
/
processes.c
diff --git
a/src/processes.c
b/src/processes.c
index
c8e7b82
..
aa47f33
100644
(file)
--- a/
src/processes.c
+++ b/
src/processes.c
@@
-25,7
+25,7
@@
*
* Authors:
* Lyonel Vincent <lyonel at ezix.org>
*
* Authors:
* Lyonel Vincent <lyonel at ezix.org>
- * Florian octo Forster <octo at
verplant
.org>
+ * Florian octo Forster <octo at
collectd
.org>
* Oleg King <king2 at kaluga.ru>
* Sebastian Harl <sh at tokkee.org>
* Andrés J. Díaz <ajdiaz at connectical.com>
* Oleg King <king2 at kaluga.ru>
* Sebastian Harl <sh at tokkee.org>
* Andrés J. Díaz <ajdiaz at connectical.com>
@@
-128,8
+128,12
@@
# include <kstat.h>
#endif
# include <kstat.h>
#endif
-#ifndef ARG_MAX
-# define ARG_MAX 4096
+#ifndef CMDLINE_BUFFER_SIZE
+# if defined(ARG_MAX) && (ARG_MAX < 4096)
+# define CMDLINE_BUFFER_SIZE ARG_MAX
+# else
+# define CMDLINE_BUFFER_SIZE 4096
+# endif
#endif
typedef struct procstat_entry_s
#endif
typedef struct procstat_entry_s
@@
-1686,7
+1690,7
@@
static int ps_read (void)
DIR *proc;
int pid;
DIR *proc;
int pid;
- char cmdline[
ARG_MAX
];
+ char cmdline[
CMDLINE_BUFFER_SIZE
];
int status;
procstat_t ps;
int status;
procstat_t ps;
@@
-1824,7
+1828,7
@@
static int ps_read (void)
* filter out threads (duplicate PID entries). */
if ((proc_ptr == NULL) || (proc_ptr->ki_pid != procs[i].ki_pid))
{
* filter out threads (duplicate PID entries). */
if ((proc_ptr == NULL) || (proc_ptr->ki_pid != procs[i].ki_pid))
{
- char cmdline[
ARG_MAX
] = "";
+ char cmdline[
CMDLINE_BUFFER_SIZE
] = "";
_Bool have_cmdline = 0;
proc_ptr = &(procs[i]);
_Bool have_cmdline = 0;
proc_ptr = &(procs[i]);