sigaction : using "void (*sa_sigaction)(int, siginfo_t *, void *);"

A

Alexandre

hello,

in sigaction manpage it's written :

sa_sigaction also specifies the action to be associated with signum.
This function receives the signal number as its first argument, a
pointer to a siginfo_t as its second argument and a pointer to a ucon-
text_t (cast to void *) as its third argument.

so we can pass arguments to the signal handler (throught "void*"), but I
can't find the way...
no way to put it anywhere...

example :

void ping(int sig, siginfo_t *siginf, void *ptr)
{
....
}

int main()
{
struct sigaction sa_ping;
int foo;

foo = 3;

sa_ping.sa_sigaction = ping;
sigemptyset(&sa_ping.sa_mask);
sa_ping.sa_flags = 0;
sigaction(SIGUSR1, &sa_ping, 0);
....
}

where I can pass foo value in argument in ping (with a cast in (int *) )???


if someone has an idea, I'll be thankfull

Alexandre
 
E

Eric Sosman

Alexandre said:
hello,

in sigaction manpage it's written :
[lots of stuff having nothing to do with C]

You probably want comp.unix.programmer. Followups set.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top