1830862 Members
2560 Online
110017 Solutions
New Discussion

process name

 
H.Merijn Brand (procura
Honored Contributor

process name

Is there a C-level call to change the process name of a running process? I mean the name shown in ps(1) *after* the fork/exec.

Someone suggested 'setproctitle', but I don't have a manpage from that, nor do I have that function in a lib.
Enjoy, Have FUN! H.Merijn
2 REPLIES 2
H.Merijn Brand (procura
Honored Contributor

Re: process name

Found:

#ifdef __hpux
#include
#endif


#if defined(__hpux) && defined(PSTAT_SETCMD)
{
union pstun un;
s = SvPV(sv, len);
un.pst_command = s;
pstat(PSTAT_SETCMD, un, len, 0, 0);
}
#endif
Enjoy, Have FUN! H.Merijn
John Poff
Honored Contributor

Re: process name

Hi,

That is pretty slick, but I can see where that could be really dangerous in the wrong hands.

On the other hand, it could make for some interesting labs in the HP-UX Troubleshooting class! :)

JP