1 The basic principle of modifying the name of the linux process
The linux process uses argv[0] as the name of the process, so it is only necessary to modify the string at argv[0] to modify the name of the linux process.
2 Problems caused by directly modifying argv[0]
If the name process, argv[0] can't be put down, it will step on the following parameters or the following environment variables.
The environment variables of the process are stored immediately after the argv string array.
3 Solutions
First save argv and environment variables, then modify argv[0], and then copy the original content behind argv[0] to the new argv[0].
The setproctitle that appears in various c programs is the name of the modified process.