Questions tagged [signalhandler]

6 questions
3
votes
0 answers

Is local static variable initialization AS Safe in signal handler (Async Signal Safe)?

I wonder which I can use in my signal handler? void my_signal_handler(int signo, siginfo_t* info, void* arg) { static std::atomic_flag my_flag = ATOMIC_FLAG_INIT; if (my_flag.test_and_set()) { ... } else { ... } …
0
votes
0 answers

Memory protection keys: Exception handler crashes if pkey0 is write-disabled

I am interested in inprocess isolation in x86/linux via memory protection keys (MPK) and the protection key register PKRU. My setup includes administrator code that allocates memory with specific access privileges via MPK, moves the user stack…
0
votes
1 answer

Signal handler example

I am trying to understand how signal handler work. I saw an example on geeksforgeek: int val = 10; void handler(int sig){ val += 5; } int main(){ pid_t pid; signal(SIGCHLD, handler); if((pid = fork()) == 0){ val -= 3; …
0
votes
3 answers

Can we send parameters to a signal handler using sigaction?

I notice that sigaction has a alternate signal handler that is called when the SA_SIGINFO flag is set. The alternate function has a void* context parameter. Now, according to the APUE book, this parameter can be cast into a ucontext_t structure. My…
0
votes
1 answer

C Two child process sending signal to parent, parent replies

I have a problem sending multiple signals to parent process in c. I've been trying for a long time now and I still end up in a deadlock or a waitlock. But I think it shouldn't be that complicated, I simply can't understand what is going on.. So I…
Shapperd
  • 155
  • 8
-1
votes
0 answers

UNIX signal handler, wait for previous signal

In APUE, in section 10.10, after figure 10.7, the following paragraph was written 1- If the caller already has an alarm set, that alarm is erased by the first call to alarm(). We can correct this by looking at alarm()’s return value. If the…
tahzibi
  • 77
  • 6