Regrading signal/sigaction.

siva kumar (mobi_linux@yahoo.com)
Tue, 26 Jun 2001 15:54:15 -0700 (PDT)


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/