Question

In HPUX 11.31 this works:

#include <sys/pstat.h>
char* tmp = (char*)malloc(256);
pstat_getcommandline(tmp, sizeof(char)*256, (size_t)1, (int)pid)

But on HPUX 11.11 pstat_getcommandline isn't defined in /usr/include/sys/pstat.h. I've tried calling pstat() directly (passing in PSTAT_GETCOMMANDLINE as the first parameter, which does happen to be defined in /usr/include/sys/pstat/pstat_ops.h on 11.11), but this fails. I noticed that pst_command_name is not defined in the pstun union in /usr/include/sys/pstat.h on 11.11.

Is there some alternative method for getting the command line on HPUX 11.11?

Was it helpful?

Solution

This works on HPUX 11.11:

#include <sys/pstat.h>
char* tmp = (char*)malloc(64);
struct pst_status s;
pstat_getproc(&s,sizeof(s), 0, (int)pid)
tmp = strdup(s.pst_cmd);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top