mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Regrading signal/sigaction.
@ 2001-06-26 22:54 siva kumar
  0 siblings, 0 replies; only message in thread
From: siva kumar @ 2001-06-26 22:54 UTC (permalink / raw)
  To: linux-kernel

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/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-06-26 22:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-26 22:54 Regrading signal/sigaction siva kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®