From 2fc550c8fdbc1739cdbdaeb6478a1857dfc919a6 Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sat, 18 Apr 2009 08:57:41 -0700 Subject: [PATCH] (SIGAR-130) Use pstat_getcommandline on HP-UX 11iv2+ --- src/os/hpux/hpux_sigar.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index aab66782..e0cf4796 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -380,15 +380,18 @@ int sigar_proc_state_get(sigar_t *sigar, sigar_pid_t pid, return SIGAR_OK; } -/* - * XXX: pst_cmd is only 64 chars of the command args. - * according to HP forums there isn't a way to get them - * all if > 64 - */ int sigar_os_proc_args_get(sigar_t *sigar, sigar_pid_t pid, sigar_proc_args_t *procargs) { char *args, *arg; +#ifdef PSTAT_GETCOMMANDLINE + char buf[1024]; /* kernel limit */ + + if (pstat_getcommandline(buf, sizeof(buf), sizeof(buf[0]), pid) == -1) { + return errno; + } + args = buf; +#else struct pst_status status; if (pstat_getproc(&status, sizeof(status), 0, pid) == -1) { @@ -396,6 +399,7 @@ int sigar_os_proc_args_get(sigar_t *sigar, sigar_pid_t pid, } args = status.pst_cmd; +#endif while (*args && (arg = sigar_getword(&args, ' '))) { SIGAR_PROC_ARGS_GROW(procargs);