Examveda

What happnes as the signal SIGINT hits the current process in the program?
#include<stdio.h>
#include<signal.h>
 
void response (int);
void response (int sig_no)
{
    printf("Linux\n");
}
int main()
{
    struct sigaction act;
    act.sa_handler = response;
    act.sa_flags = 0;
    sigemptyset(&act.sa_mask);
    sigaction(SIGINT,&act,0);
    while(1){
        printf("Example\n");
        sleep(1);
    }
    return 0;
}

A. the process terminates

B. the string "Linux" prints

C. the string "Linux" prints and then process terminates

D. none of the mentioned

Answer: Option B


This Question Belongs to Computer Science >> Linux

Join The Discussion

Related Questions on Linux