# 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
int getprocs64 (void *procsinfo, int sizproc, void *fdsinfo, int sizfd, pid_t *index, int count);
int getthrds64( pid_t, void *, int, tid64_t *, int );
#endif
-int getargs (struct procentry64 *processBuffer, int bufferLen, char *argsBuffer, int argsLen);
+int getargs (void *processBuffer, int bufferLen, char *argsBuffer, int argsLen);
#endif /* HAVE_PROCINFO_H */
/* put name of process from config to list_head_g tree
DIR *proc;
int pid;
- char cmdline[ARG_MAX];
+ char cmdline[CMDLINE_BUFFER_SIZE];
int status;
procstat_t ps;
* 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]);