(SIGAR-130) Use pstat_getcommandline on HP-UX 11iv2+

This commit is contained in:
Doug MacEachern 2009-04-18 08:57:41 -07:00
parent 4bffa314d2
commit 4d0046fa25
1 changed files with 9 additions and 5 deletions

View File

@ -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);