Questions tagged [sigchld]
70 questions
1
vote
2 answers
SIGCHLD handler reinstall
I see some example of SIGCHLD handler like:
void child()
{ …

Oxdeadbeef
- 1,033
- 2
- 11
- 26
1
vote
1 answer
How can waitpid() reap more than one child?
In this example from the CSAPP book chap.8:
\#include "csapp.h"
/* WARNING: This code is buggy! \*/
void handler1(int sig)
{
int olderrno = errno;
if ((waitpid(-1, NULL, 0)) < 0)
sio_error("waitpid error");
Sio_puts("Handler…

sociala
- 11
- 3
1
vote
0 answers
Timer disarms when interval is too small
Timers seem to disarm after process is resumed (SIGCONT) ONLY when interval is too small.
I use timer_create with CLOCK_REALTIME.
My linux distribution is ubuntu 20.04.1
This is the code that shows the problem
#include
#include…

K.Wierciak
- 11
- 3
1
vote
0 answers
Handler for SIGCHLD signals
The code doesn't work and it goes in loop. I think the error is in the gestore method, that is a handler for SIGCHLD signals. This is the first time I use a handler to capture SIGCHLD signals.
This program continue to casually extracts from 0 to…
user9062823
1
vote
1 answer
Unable to getpgid() for a pid inside sigchld_handler
In the shell I am developing, I execute a set of commands A | B | C by forking children to execute each child in the pipe. The 3 children all have the same PGID as that of the first child. That is, the 3 children with PID x, y, z have PGID = x. The…

Shubs
- 90
- 1
- 7
1
vote
1 answer
Signal handling for background processes
I'm trying to implement a simple Unix shell in C. However, I could not implement background process feature by using sigaction. My code structure is like the following:
int main() {
struct sigaction act;
act.sa_handler = handler;
sigaction(SIGCHLD,…

Enes Altuncu
- 449
- 2
- 7
- 14
1
vote
1 answer
Change child process' termination signal at runtime
Using clone() to fork a process you can specify the signal a child process should send its parent on death instead the "normal" SIGCHLD.
Is it possible to change the set termination signal after the child was created? Either by the child or the…

Kijewski
- 25,517
- 12
- 101
- 143
1
vote
1 answer
Don't want to remove terminated child process immediately, need to become zombie
I got below information from SE QUE
Explicitly setting the disposition of SIGCHLD to SIG_IGN causes any child process that subsequently terminates to be immediately removed from the system instead of being converted into a zombie.
As far I know, to…

kapilddit
- 1,729
- 4
- 26
- 51
1
vote
0 answers
Learning to fork() idle processes in C++
Here's a revision of my programming problem:
Fork off two idle processes that run for a random time, each one
running between 0 - 20 seconds.
Processes should use signals SIGSTOP and SIGCONT to schedule the
processes in a round-robin queue.
When…

Lord Bahamut
- 153
- 1
- 3
- 19
1
vote
1 answer
SIGCHLD sended by another process to parent
Let's assume that our process creates a child and then calls wait().
When I try to send signal() or do
kill -SIGCHLD
nothing happens at all.
So the question is: How does the process in Linux determine that signal SIGCHLD hadn't been sent…

Acapello
- 127
- 9
1
vote
2 answers
linux - sleep() of parent process interrupted by child process
When a child process is fork() ed , then the parent process can wait() for the child process to complete . Suppose , just for experimenting , instead of wait() ing , if we make the parent process sleep() , then why does not it work ?
#include…

Subbu
- 2,063
- 4
- 29
- 42
1
vote
1 answer
Blocking Signals for a Handler
I have set a handler for each signal (SIGCHLD, SIGTSTP, SIGINT), now I need to block other signals while some handler running .
There is some resources like sigaction(2) and Blocking for Handler , but I didn't understand what should I do in my…

Rawhi
- 6,155
- 8
- 36
- 57
1
vote
3 answers
Which child process send SIGCHLD
I'm trying to understand the signal handling and process. I have a parent process that created several child processes. Now in the parent process I have a list of all child processes. when a child is terminated I want to delete it from the list. I…

orenma
- 1,163
- 2
- 10
- 19
1
vote
1 answer
syntax of sigchld and its declaration
On compiling my C program for implementing multiple client server chat program using UDP ,i got some errors..I was able to correct some of them, but cannot do with some others..
They are....:
1) unknown type name sig_atomic_t
2) storage size of…

user2655620
- 259
- 1
- 3
- 6
1
vote
2 answers
execl()-ing in parent process: SIGCHLD caught by ps
I'm doing an assignment on fork(),exec() and related UNIX calls where I need to show the zombie state of a (child) process. Here's the relevant piece of code:
pid = vfork(); //used vfork() for showing z state
if(pid>0)
{
(some sorting code)
…

Kedar Paranjape
- 1,822
- 2
- 22
- 33