PDA

Click to See Complete Forum and Search --> : [RESOLVED] Changing the process name.


wossname
Jun 12th, 2008, 06:42 AM
I want to fork my app into 4 processes and have a unique name for each one that shows up in `top`. Currently, top shows the same process name for each process (eg the name inherited from the parent process) which makes life difficult when trying to kill a specific process.

Is this even possible? I'm already using the argv[0] trick to change the command line for the forked processes but this doesn't show up in `top`.

I'm coding in C under Linux and Solaris by the way.

CyberSurfer
Jun 13th, 2008, 04:58 AM
You can use top with the -c option to view the entire command line instead of just the command name.

Also, if you run

ps -axjf

It will give you a process tree and preserve command line arguments which can be useful for making sure you don't kill the parent :)

wossname
Jun 13th, 2008, 12:51 PM
Yeah that's what we were having to do previously.

Anyway, a colleague of mine found a nice undocumented feature and it seems to work...

http://www.vbforums.com/showthread.php?p=3256555#post3256555