I have a shared library that occasionally throws SIGSEGV by design. I can find out if a SIGSEGV is caused by me, and if it is then handle it. However I ran into some problems when implementing the other branch (ie. when it isn’t my SIGSEGV). My primary problem is what if a handler was set to SIG_DFL. This is
Tag: signals
How do I install a signal handler for a custom I/O signal?
I am trying to set up a signal and signal handler to rebuffer CAN frames as they arrive. Below is my code. I can send a frame from the computer running this code, but when I send a frame back the other way, nothing happens. I am holding the programme with scanf(). Can you see why this signal handler is
Linux signals program doesn’t return the same value on each execution
I have this code: this program to my understanding should always print cpt = 5 but when i run it on my machine it returns different values (3,4,5) why is that? Answer The SIGCHLD signal is a little funny and doesn’t work like you’d expect: we think we should get one signal per child death, but that’s not it. Instead,
C Programming – Counting signals in signal handler
I am working on signals in C programming. I have parent process and 5 child processes, I am trying to send SIGUSR2 from child processes to parent process when they are done some calculations while parent waits for them with sigsuspend(). When all 5 child processes sends SIGUSR2, parent process continues its work. I increment a global variable in the
Send a kill signal to self
I have a C++ code that runs a linux command, I want to simulate segfault i.e. SIGSEGV while executing that linux command from by C++ code. So my code looks like this What should I put in “cmd” so that it can send SIGSEGV to the sub-process created by calling this function? Answer Sending kill signal to self can by
C++ + linux handle SIGPIPE signal
Yes, I understand this issue has been discussed many times. And yes, I’ve seen and read these and other discussions: 1 2 3 and I still can’t fix my code myself. I am writing my own web server. In the next cycle, it listens on a socket, connects each new client and writes it to a vector. Into my class
Signals – SIGUSR1 class exercise
I got this as a class exercise. I had to analyze the output without running it and I figured that the output should be num=4. But actually the output of this code after running it is: I’ll be glad to know what am I missing? Answer This is an interesting question. So what’s happening is that a signal handler is
different ways to ignore a signal?
Im’ new to Linux and signal handling. the signal function prototype is below is my questions: Q1-if I want to ignore SIGINT signal, then I just need to simply code as: signal(SIGINT, SIG_IGN);, is my understanding corrct? Q2-What if I code as: since my own sigint_handler does nothing, it is pretty much like ignoring the SIGINT, so can I say
Communication between two processes without using fork()
I’m trying to do a ping pong exercise, I ask for guidance / direction but not a solution so I can learn. Workspace: ubuntu 19 Language: C. The task is like this: Do not use () fork The ping process is waiting for a signal The Pong process gets the Ping PID from the command line as an argument Pong
Why does SIGHUP not work on busybox sh in an Alpine Docker container?
Sending SIGHUP with to a busybox sh process on my native system works as expected and the shell hangs up. However, if I use docker kill to send the signal to a container with it doesn’t do anything. The Alpine container is still running: By the way, with an Ubuntu container (which runs bash) it does work as expected: Sending