Bonne question : comment on fait pour changer le nom d'un process (visible via ps ou /proc). Par exemple, au lieu d'avoir la commande nginx on voit "nginx: worker process".
Ok, y'a pas de vraie technique, juste écraser l'espace mémoire pointé par argv[0] :
To change the process title in Linux and Solaris we have to set argv[1] to NULL and to copy the title to the same place where the argv[0] points to. However, argv[0] may be too small to hold a new title. Fortunately, Linux and Solaris store argv[] and environ[] one after another. So we should ensure that is the continuous memory and then we allocate the new memory for environ[] and copy it. After this we could use the memory starting from argv[0] for our process title.