Skip to content

Instantly share code, notes, and snippets.

@alsamitech
Created October 17, 2020 06:15
Show Gist options
  • Select an option

  • Save alsamitech/a33080966ed058bf368266f2a567be6d to your computer and use it in GitHub Desktop.

Select an option

Save alsamitech/a33080966ed058bf368266f2a567be6d to your computer and use it in GitHub Desktop.
Makes a process that is not killable with ^C (Unix Only)
#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