Questions tagged [sigchld]
70 questions
0
votes
1 answer
Proper way of handling SIGCHLD, EINT, and accept() in Linux
I have a program that creates a TCP server. When the accept() connects to a client, I fork() it and handle the connection. When that client leaves it calls the waitpid() because of the SIGCHLD, but this causes a EINTR in the accept(). My question…

Rich G.
- 61
- 1
- 1
- 5
0
votes
0 answers
If I set signal(SIGCHLD, SIG_IGN); to avoid zombies - system() returns -1 and "No child processes"
I have a simple server which does fork for a new socket connection.
If I set signal(SIGCHLD, SIG_IGN); to avoid zombies when I call system()
in child process to execute needed script - everything is executed fine but seems like child gets removed…

pulse
- 303
- 4
- 18
0
votes
1 answer
C - Under what conditions will a call to waitpid() return -1, signalling an error?
I'm writing a SIGCHLD handler and I'm wondering under what conditions would a call to waitpid() return -1?
More specifically, if I create a loop in which I call waitpid(...) and want it to run until all terminated child processes have been reaped,…

fvgs
- 21,412
- 9
- 33
- 48
0
votes
0 answers
Catching multiple SIGCHLD processes for Unix Style Shell in C
I am writing an extensible shell am I am working on an issue related to catching SIGCHLD signals from a Unix kernel.
I am trying to maintain a list of current jobs (so when the user types "jobs" into the shell I can return the appropriate jobs).…

Rich Episcopo
- 499
- 1
- 5
- 17
0
votes
1 answer
C mini shell, problems with handling SIGCHLD
So i am implementing a mini C shell, it's supporting background processes. My idea was that for the background mode, the parent process doesn't wait for its children process to finish but rather register them in a job list and when they are done, i…

user2966439
- 307
- 1
- 5
- 14
0
votes
1 answer
How to safely `waitpid()` in a plugin with `SIGCHLD` handler calling `wait()` setup in the main program
I am writing a module for a toolkit which need to execute some sub processes and read their output. However, the main program that uses the toolkit may also spawn some sub processes and set up a signal handler for SIGCHLD which calls wait(NULL) to…

yuyichao
- 768
- 6
- 28
0
votes
1 answer
Get PID of a child process after finishing in FreeBSD and C language
I'm trying to handle SIGCHLD properly, but I don't manage to get the PID of the process inside the handler so I can change the value of one parameter inside an structure.
Here is the code:
typedef struct
{
int active_state;
int…

Javier
- 181
- 8
0
votes
3 answers
SIGCHLD not being caught
I intend the following code to fork and exec "sleep 3" as a child while the parent process sleeps for 10s. I expect the parent process to receive SIGCHLD after 3s, when the "sleep 3" sompletes.
This does not happen, instead I get:
main
parent…

fadedbee
- 42,671
- 44
- 178
- 308
0
votes
1 answer
Catching SIGCHLD using sigtimedwait() on BSD
I am having trouble using sigtimedwait() to catch SIGCHLD signals on FreeBSD. The following source works well on Debian GNU/Linux 7 but gives me a Resource temporarily unavailable on FreeBSD 9.1:
#include
#include
#include…

pp3345
- 31
- 3
0
votes
1 answer
python select not interupted by SIGCHLD
i have the following piece of code:
try:
r_l, w_l, e_l = select.select([connection_fd], [], [], timeout_secs)
except select.error as (err_no, msg):
# get interrupted on select
While my program waits on this, if there is a signal (like…

learner
- 93
- 8