Created
October 17, 2020 06:15
-
-
Save alsamitech/a33080966ed058bf368266f2a567be6d to your computer and use it in GitHub Desktop.
Makes a process that is not killable with ^C (Unix Only)
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> | |
| #include <signal.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| void handler(int num){ | |
| write(STDOUT_FILENO, "Kill Proceess Request Failed\n", 13); | |
| } | |
| int main() { | |
| signal(SIGINT, handler); | |
| for(;;){ | |
| printf("Process ID: %d\n". getpid()); | |
| sleep(1); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment