1
I’m trying to write a program that stays on an infinite loop, and can’t be stopped by the SIGINT( C signal on the keyboard).
What I have so far is the following code:
void sigint();
int main()
{
int pid;
pid = fork();
if(pid == -1)
{
perror("fork");
exit(1);
}
if(pid == 0)
{
signal(SIGINT, SIG_IGN);
}
else
{
sleep(3);
printf("\nPARENT: sending SIGINT\n\n");
kill(pid,SIGINT);
}
void sigint()
{ while(1);}