I have a server application that forks several child processes. When showing the processes with ps, top or prstat they display exactly like the parent process. I can find out which is parent and child by their pid and ppid but it gets quickly difficult. I would like to change slightly the name of the child processes so that I can look quickly which does what.
I tried several tricks that all work flawlesly on Linux, but they do not on Solaris. Does anyone know how it is possible to do that and preferably in plain C.
One of the ways would be to create a real executable program for a child process and call one of the
execmethods from the fork.This way the forked process will be “replaced” with the new executable file.
Something along these lines: