Regrading signal/sigaction.

From: siva kumar (mobi_linux@yahoo.com)
Date: Tue Jun 26 2001 - 17:54:15 EST


Hi,

Is it possible to pass any local variable as an
argument in the signal handler function.Basically I
want to print the value of the local variable in the
signal handler function.

In the below program I want to print the value of a in
the timeout function(siganl handler), whenever the
Alaram signal send.

Your comment are welcomed.

My prototype code is:

#include<stdio.h>
#include<signal.h>
void timeout(int signo,int a)
{
        printf ("timeout");
        printf("the value is %d and %d",signo,a);
}
 
main()
{
        int a =5;
        struct sigaction act,oact;
        act.sa_handler = timeout;
        sigemptyset(&act.sa_mask);
        act.sa_flags = 0;
        sigaction(SIGALRM, &act, &oact);
 
        alarm(10);
        sleep(10);
 
}

Thanks,
siva.s

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year! http://personal.mail.yahoo.com/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 30 2001 - 21:00:15 EST