Questions tagged [sigchld]
70 questions
20
votes
2 answers
Java signal chaining
I've got a program with a specialized Process-type class which handles executing the processes natively on Linux.
It does not use Java's Process class at all, because it needs to do some special handling of the process. Because of this, it also…

rm5248
- 2,590
- 3
- 17
- 16
15
votes
1 answer
How can I handle SIGCHLD?
I need to handle SIGCHLD properly. How can I use it with my existing code? at the moment I cant wait for the child process unless I use 0 instead of WNOHANG|WUNTRACED.
status = 0;
pid_t child, endID;
if(amp == 1)
signal( SIGCHLD, SIG_IGN…

kanoz
- 151
- 1
- 1
- 4
11
votes
1 answer
Not receiving SIGCHLD for processes executed with sudo
I'm currently in the process of writing a shell. I execute processes and utilize a SIGCHLD signal handler to clean up (wait on them) when they are complete.
Everything has been working -- except when I execute processes which escalate privileges…

BSchlinker
- 3,401
- 11
- 51
- 82
9
votes
2 answers
SIGCHLD Signal Processing
In Unix, when a child process in background terminates, it sends a SIGCHLD signal to the parent to inform it that it terminated.
Does the same happen even if the process was in foreground? If so, this means the parent will just ignore it.
Is this…

darksky
- 20,411
- 61
- 165
- 254
8
votes
4 answers
What's the difference between various $SIG{CHLD} values?
What is the difference between these settings?
$SIG{CHLD} = 'IGNORE'
$SIG{CHLD} = 'DEFAULT'
$SIG{CHLD} = ''
$SIG{CHLD} = undef
According to "Advanced Programming in the UNIX Environment, 2nd edition", figure 10.1 the default value of SIGCHLD…

Trueblood
- 515
- 2
- 5
- 11
7
votes
1 answer
bash restart sub-process using trap SIGCHLD?
I've seen monitoring programs either in scripts that check process status using 'ps' or 'service status(on Linux)' periodically, or in C/C++ that forks and wait on the process...
I wonder if it is possible to use bash with trap and restart the…

X.M.
- 941
- 3
- 14
- 22
5
votes
2 answers
Is there a way to prevent only a specific child from triggering a SIGCHLD?
I'm writing a debugging utility, and I want to fork a child while preventing that child's termination from triggering a SIGCHLD to its parent. I still want other children to normally cause a SIGCHLD upon termination.
I want to do this because I…

Moh
- 304
- 2
- 8
4
votes
1 answer
Trapping CHLD signal - ZSH works but ksh/bash/sh don't?
Here's a sample code where a shell script launches a few jobs in the background and upon receiving the CHLD signal (i.e. the child process termination) it will take some actions... The problem is that if the parent shell script is a ZSH one, it…

Reza Toghraee
- 1,603
- 1
- 14
- 21
4
votes
2 answers
SIGCHLD Replacement for Windows
I would like to have SIGCHLD functionality on Windows (i.e., notify the parent process when a child dies). I am aware that there is no equivalent to SIGCHLD in the Windows API, but I'd like to know what the common method is for implementing this…

Matt Fichman
- 5,458
- 4
- 39
- 59
4
votes
1 answer
error: conflicting types for ‘wstat’ in gcc
I copied this program from this documentation: https://docs.oracle.com/cd/E19455-01/806-4750/signals-7/index.html
#include
#include
#include
#include
void proc_exit()
{
int wstat;
…

Ashot
- 10,807
- 14
- 66
- 117
4
votes
2 answers
How To Avoid SIGCHLD error In Bash Script That Uses GNU Parallel
I'm running a script.sh in a loop. The script contains a parallel wget command. I'm getting the following error:
Signal SIGCHLD received, but no signal handler set.
The loop looks like this:
for i in {1..5}; do /script.sh; done
And the line that…

DomainsFeatured
- 1,426
- 1
- 21
- 39
4
votes
2 answers
how a process know's which child ended?
when a process child is terminated he's sending a SIGCHLD to the parent process. Now, if the parent process have more than one child how the parent process knows which child had sent the signal?

orenma
- 1,163
- 2
- 10
- 19
4
votes
1 answer
Can you call signal() from within a signal handler?
I have a supervisor program that generally wants to receive SIGCHLD events. However, after it receives SIGTERM or similar signal, it would be safe and desirable to ignore SIGCHLD events to prevent zombies. The issue is that I'm not sure if it's…

Benjamin Pollack
- 27,594
- 16
- 81
- 105
4
votes
4 answers
How do I receive notification in a bash script when a specific child process terminates?
I wonder if anyone can help with this?
I have a bash script. It starts a sub-process which is another gui-based application. The bash script then goes into an interactive mode getting input from the user. This interactive mode continues…

starfry
- 9,273
- 7
- 66
- 96
3
votes
1 answer
How to handle SIGHLD
I'm having some troubles using sigchld...
what I want to do is to create a child process with fork and make the child print and sleep a second for a couple of times... during these process I want to send signal to child (SIGSTOP and SIGCONTINUED)…
user4334017