Thread (2 messages) 2 messages, 2 authors, 2011-12-01

About signal handler install info

From: rahul dev <hidden>
Date: 2011-12-01 10:13:24

See sigaction.
--- On Thu, 1/12/11, naveen yadav <yad.naveen@gmail.com> wrote:
From: naveen yadav <redacted>
Subject: About signal handler install info
To: Kernelnewbies at kernelnewbies.org, kernelnewbies at nl.linux.org
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 at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help