-
-
Save indutny/5b969331e759f17841a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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. | |
* | |
* The Solaris's standard /bin/ps does not show the changed process title. | |
* You have to use "/usr/ucb/ps -w" instead. Besides, the UCB ps does not | |
* show a new title if its length less than the origin command line length. | |
* To avoid it we append to a new title the origin command line in the | |
* parenthesis. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment