Created
August 24, 2012 18:05
-
-
Save Osse/3453654 to your computer and use it in GitHub Desktop.
Annoying program
This file contains hidden or 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> | |
int main(int argc, char const *argv[]) { | |
pid_t pid = fork(); | |
if (pid) { | |
printf("The daemon's PID is %i.\n", pid); | |
} | |
else { | |
printf("The daemon is now running.\n"); | |
// setsid(); // New SID | |
// umask(0); // The deamon can't create files | |
// chdir("/"); // Set the cwd to something that always exists | |
// fclose(stdin); // We close the | |
// fclose(stdout); // common file | |
// fclose(stderr); // descriptors | |
while(1) { | |
sleep(1); | |
printf("This is really annoying!\n"); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment