Questions tagged [sigchld]
70 questions
3
votes
1 answer
SIGCHLD handler in c - unwanted wait
I've the following problem with the SIGCHLD handler function.
The handler code is pretty simple:
void sigchld_handler(int signum)
{
pid_t ended;
signal(SIGCHLD, sigchld_handler);
ended = wait(NULL);
// do some stuff with the PID…

Shai
- 1,093
- 4
- 13
- 20
2
votes
1 answer
SIGCHLD not delivered in a process tree
I am trying to create a process that manage some other process in the way that if a child die then the parent restart the process and the process that depend from it.
The problem is that I notice that if I create a tree structure of process when I…

user976900
- 68
- 1
- 5
2
votes
1 answer
SIGCHLD handling Beej's Guide example
here is the code
void sigchld_handler(int s)
{
while(waitpid(-1, NULL, WNOHANG) > 0);
}
// get sockaddr, IPv4 or IPv6:
void *get_in_addr(struct sockaddr *sa)
{
if (sa->sa_family == AF_INET) {
return &(((struct…

cap10ibrahim
- 587
- 1
- 6
- 16
2
votes
1 answer
UNIX signal handling. Wait in SIGCHLD handler. C
I've a parent and a child processes. In the parent I established a signal handler for a SIGCHLD. I send SIGTSTP signal to the child, that trigers SIGCHLD and in SIGCHLD siganl handler in parent I call wait function to get a status of the stopped…

Игорь Корпенко
- 63
- 6
2
votes
1 answer
Why does a child process killed due to a segmentation fault not die immediately?
I need to write a C++ code which accepts a certain input and prints the respective output. This code is meant to be run using the Python subprocess module. Regardless of inputs and outputs, I need to make sure that the Python code does not terminate…

Shashank Shet
- 324
- 4
- 11
2
votes
2 answers
Will a child process send SIGCHLD on abort()?
If an application does a fork() and the child dies with an abort() (due to failing an assert()), will the parent process receive a SIGCHLD?
If it's relevant this is on Debian 4 (gcc version 4.1.2).

John Carter
- 53,924
- 26
- 111
- 144
2
votes
2 answers
Waitpid interrupted by system call
I am forking a child process to run a command using execve. I am installing and defining 3 signal handlers: SIGCHLD,SIGINT and SIGSTP as follows:
void sigchld(int sig)
{
while((pid=waitpid(-1,&stat,WNOTRACE|WNOHANG))>0)
{
if(WIFEXITED(stat))
…

Maxsteel
- 1,922
- 4
- 30
- 55
2
votes
1 answer
Parent process does not wait for all children to exit using signal()
The program initially asks the user to input the number of child processes to create. After creating the children, the parent sleeps and waits for all its children to terminate via a signal handler function 'handle_child' registered with SIGCHLD.…

Nishad
- 102
- 1
- 3
- 9
2
votes
1 answer
How can I get the PID of a dead child process and use it in the parent?
I'm trying to make a C program (for FreeBSD, Unix) which creates 4 children processes in a loop. Each child does things and, when they die, they are replaced immediately by other children. So, in the end, I have 4 children working all the time.
Each…

Vertice
- 21
- 3
2
votes
1 answer
what is the relation between SIGTSTP and SIGCHLD
I have tow handlers for each one of them (SIGTSTP, SIGCHLD), the thing is that when I pause a process using SIGTSTP the handler function of SIGCHLD run too. what should I do to prevent this .
signal handlers :
void signalHandler(int signal) {
int…

Rawhi
- 6,155
- 8
- 36
- 57
2
votes
1 answer
zombie process,SIGCHLD,exit in unix
Does every exit(either_exit or exit) from a child send SIGCHLD to its parent?If it is so then how is a zombie process created?As wait system call is commonly invoked in the SIGCHLD handler.

user2452230
- 21
- 2
2
votes
1 answer
mount() and jffs2_gcd_mtd0 garbage collector
I'm working on a platform running MontaVista Linux 3.1.
I have a C++ application, which for esoteric reasons which I won't go into, has to remount the JFFS2 flash file system quite regularly between read-only and read-write.
When you perform a int…

Matt Dunn
- 5,106
- 6
- 31
- 55
2
votes
2 answers
Sleep Through SIGCHLD
I have a C program that polls some hardware sensors once a minute, and adds the readings to a database. To ensure that the readings are taken closer to minutely (instead of minutely + overhead time), the program creates a child to do the actual…

Jamie Butler
- 235
- 1
- 2
- 19
2
votes
1 answer
perl, no child process w/ "open"
Hi I have this problem where the perl script spits back "No child process found at" ...
My script calls several different types of forks, so I tried implementing the perldoc's waitpid() implementation method to be able to use handle both fork & exec…

user1539348
- 513
- 1
- 7
- 20
1
vote
1 answer
An unreaped child and its future
So when a child dies parent gets SIGCHLD but if parent dies before doing wait(), the child is reparented to init. At this point in time the child is a zombie i.e. .
What happens next?
Does init do wait() on that child? if yes, when does it…

hari
- 9,439
- 27
- 76
- 110