Parameters in the Signals Handler

Asked

Viewed 35 times

0

I have a doubt and even after searching I could not solve.

Let’s say I have the following signal handler:

struct sigaction conf_signal;
conf_signal.sa_flags = 0;
sigemptyset(&conf_signal.sa_mask);
conf_signal.sa_handler = &sinal_chegou;

And the following code inside a for:

    if (sigaction(SIGINT, &conf_signal, NULL) == -1) {
        perror("sigaction");
        exit(EXIT_FAILURE);
    }

And my job is sinal_chegou has the following signature:

void sinal_chegou(void){

How do I send a received parameter to argv[] for the function sinal_chegou using the signal handler?

1 answer

0

Use a global variable. I don’t think there’s any other way.

  • Friend, post only objective and concrete answers, use the comments for this type of note.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.