U
Udai Kiran
Hi all
Iam having trouble with signal handler. Where will the execution
return after invoking a signal handler when that particular signal is
recieved? will return to the point where we register the signal?
The following code is recieveing recursive signals.
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5
6 void handle_sigsegv(int sig)
7 {
8 printf("Caught SIGSEGV!!\n");
9 signal(SIGSEGV,handle_sigsegv);
10 sleep(1);
11 return;
12 }
13
14 void sig_segv(){
15 int *p = NULL;
16 *p = 10;
17 }
18
19 int main()
20 {
21 int *p = NULL;
22 signal(SIGSEGV,handle_sigsegv);
23 sig_segv();
24 printf("after segfault \n");
25 return 0;
26 }
Please throw some light.
Iam having trouble with signal handler. Where will the execution
return after invoking a signal handler when that particular signal is
recieved? will return to the point where we register the signal?
The following code is recieveing recursive signals.
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5
6 void handle_sigsegv(int sig)
7 {
8 printf("Caught SIGSEGV!!\n");
9 signal(SIGSEGV,handle_sigsegv);
10 sleep(1);
11 return;
12 }
13
14 void sig_segv(){
15 int *p = NULL;
16 *p = 10;
17 }
18
19 int main()
20 {
21 int *p = NULL;
22 signal(SIGSEGV,handle_sigsegv);
23 sig_segv();
24 printf("after segfault \n");
25 return 0;
26 }
Please throw some light.