Re: About signal handler install info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



See sigaction.

--- On Thu, 1/12/11, naveen yadav <yad.naveen@xxxxxxxxx> wrote:

> From: naveen yadav <yad.naveen@xxxxxxxxx>
> Subject: About signal handler install info
> To: Kernelnewbies@xxxxxxxxxxxxxxxxx, kernelnewbies@xxxxxxxxxxxx
> Date: Thursday, 1 December, 2011, 3:33 PM
> Dear All,
> 
> I want to know is there any method/API  to know
> whether there is
> previous signal handler for specific signal no.
> 
> Example:
> 
> In below case  we install 3 handler. So my question is
> if before
> calling signal (SIGUSR1, handler2); is there any way i can
> get info
> that there is "handler1" already install with SIGUSR1.
> 
>         signal (SIGUSR1, handler1);
>         signal (SIGUSR1, handler2);
>         signal (SIGUSR1, handler3);
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <pthread.h>
> #include <signal.h>
> 
> void *func ();
> 
> void handler1 ()
> {
>         printf ("\nIn handler 1\n");
> }
> 
> void handler2 ()
> {
>         printf ("\nIn handler 2\n");
> }
> 
> void handler3 ()
> { printf ("\nIn handler 3\n"); }
> int main ()
> {
>         int err=-1;
>         pthread_t t1,t2;
> 
> 
>         signal (SIGUSR1, handler1);
>         sleep(5);
>         signal (SIGUSR1, handler2);
>         sleep(5);
>         signal (SIGUSR1, handler3);
>         sleep(5);
>         pthread_create (&t1, NULL,
> &func, NULL);
> 
>         sleep(20);
> 
>         return 0;
> }
> 
> void *func()
> {
>         while (1) usleep(10);
> }
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@xxxxxxxxxxxxxxxxx
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux