Created
August 15, 2013 08:56
-
-
Save rc5hack/6239377 to your computer and use it in GitHub Desktop.
C program that changes it's proctitle (works on FreeBSD).
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
#include <stdio.h> | |
#include <unistd.h> // for sleep() | |
// Please note, that Linux does not supports setproctitle() | |
// (but FreeBSD does) | |
int main (void) { | |
setproctitle("I am C program! (%d)", getpid()); | |
int MyTick=0; | |
puts ("Let's get some rest..."); | |
while (MyTick < 5) | |
{ | |
printf(" %d s left...\n", 5-MyTick); | |
sleep(1); | |
MyTick++; | |
} | |
printf("Hello world!\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some folks miss this call on Linux: http://stupefydeveloper.blogspot.ru/2008/10/linux-change-process-name.html