Questions tagged [signal-handling]

In the C Standard Library, signal processing defines how a program handles various signals while it executes. A signal can report some exceptional behavior within the program (such as division by zero), or a signal can report some asynchronous event outside the program (such as someone striking an interactive attention key on a keyboard).

290 questions
0
votes
2 answers

Interrupt a running c++ program from another program or terminal

I have written a c++ program which has a infinite loop. I want to run this program as a daemon (or service) in linux. I want to communicate with this running daemon from outside of program (for example console or another program). I read about…
Ali Mirzaei
  • 1,496
  • 2
  • 16
  • 27
0
votes
1 answer

__lll_lock_wait_private () when using malloc/free

I have a user level thread library and I changed a benchmark program to use mythreads instead of pthreads, but it always gets stuck somewhere in the code where there is a malloc or free function. this is output of gdb: ^C Program received signal…
zmeftah
  • 148
  • 1
  • 2
  • 10
0
votes
2 answers

Why signal handling is malfunctioning?

I have a signal handling snippet but it is somehow malfunctioning on my Mac and virtual Linux box at koding.com but on my office Linux PC it is working..Can someone please tell me why.. #include #include #include…
Mayukh Sarkar
  • 2,289
  • 1
  • 14
  • 38
0
votes
2 answers

Which anonymous areas are created/accessed by libc?

Is there a way to find out which anonymous Virtual Memory Areas are created/accessed by libc? I have a program that mprotects VMAs on its address space. But when it mprotects an area that will be accessed by libc, a SIGSEGV occurs. Unfortunately,…
Paschalis
  • 11,929
  • 9
  • 52
  • 82
0
votes
1 answer

Exit handler in expect script not removing file

I'm having some trouble with an expect script I am writing. The goal of the script is to SSH to a partner and obtain network configuration information. That information is saved in a file and copied back to the local host for processing. The file is…
legendmac
  • 43
  • 2
  • 8
0
votes
1 answer

How to catch JNI Crashes as exceptions using Signal handling based mechanism in Java

I developed a Java tool and it has many JNI functions, I am getting JNI crashes often. Is there any possibility to avoid those crashes or to catch these crashes as exceptions. I surfed internet and found it is possible through signal processing,…
0
votes
1 answer

Is it possible to always catch signal even if program just started yet?

I would like to catch signal sent to my program and do simple action (e.g. exit with specified code). But if process received a signal before my signal handler set, it exited abnormally like no handler existed. Source code of my simple…
αλεχολυτ
  • 4,792
  • 1
  • 35
  • 71
0
votes
1 answer

How to receive the signal from child

Write a program that creates a child process using fork (). The child prints its parent’s name, Parent ID and Own ID while the parent waits for the signal from the child process. Parent sets an alarm 10 seconds after the Child termination. The below…
0
votes
1 answer

c - Can't subscribe to new signal handler in Linux

I'm trying to subscribe to a new signal handler in my current signal handler but nothing happens. No output from usr1b is printed in terminal, output from usr1a is printed in…
ChristianG
  • 11
  • 3
0
votes
0 answers

how to receive from two serial port in interrupt

The code below receives data from serial port of friendlyarm board.Signal handler is able to receve data if only one port is used.When i configured another port the signalhandler get executed on reception of data at two serial ports(SGIO signal is…
0
votes
1 answer

How to access class member and methods from static method(signal handler)

I have one problem. I am writing my program on C++ language. I have one problem. I need to set signal handler for my process. As the signal is related with the process on system level I have faced the problem. My program consists of several classes.…
braohaufngec
  • 31
  • 1
  • 1
  • 8
0
votes
1 answer

Signal Handling Output Display Issue

I am creating a relatively simple multiple process program to learn about signals and signal handling in Linux using C. I have several processes handling signals (I use sigaction to assign handlers) that are sent to all processes in the process…
OwlsCIS
  • 61
  • 4
0
votes
2 answers

Multithreaded Environment - Signal Handling in c++ in unix-like environment (freeBSD and linux)

I wrote a network packet listener program and I have 2 threads. Both runs forever but one of them sleeps 30 sec other sleeps 90 sec. In main function, I use sigaction function and after installed signal handler, I created these 2 threads. After…
Creed
  • 103
  • 7
0
votes
2 answers

signal handler to terminate the main program and all forks when arrives a double SIGINT

I really didn't get how signal handlers work especially with forks. So i need to do this exercise but i couldn't get it work properly. My main program makes 5 forks, each fork prints simply 10 messages with its pid. So the purpose of the program,…
user3717434
  • 215
  • 4
  • 19
0
votes
1 answer

Android : How to catch and handle signals?

I just want to know if it is possible to catch and handle signals from all thrown exceptions? For example, a crash at runtime occurred and I want this signal handler to catch the exception for me to know the stacktrace of the crash. Yes, we know…
dzep
  • 685
  • 1
  • 8
  • 20