Вопрос

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?

Это было полезно?

Решение

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);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top