Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
SIGCHLD
Edit
PageHistory
Diff
Info
LikePages
You are viewing an old revision of this page.
View the current version
.
!!!Signal: Child process Child process has changed state. This signal is raised whenever a child process recieves a signal or terminates. This can be used to call wait4(2) to cleanup any ZombieProcess''''es that the process may have. On some Unix's it is possible to explicitly set SIGCHLD to "SIG_IGN" (ignore) and child processes will be cleaned up automatically. The default action (SIG_DFL) for this signal is to ignore it (but this does not reap the process until the parent wait()s). In perl, would do one of the following: 1. wait till child finishes ---- if (fork()==0) { # ==0 implies child process do stuff... exit; } # if fork returned -1, there was an error forking (but we'll ignore that) # if here, assume it is the parent processes wait(); # when this returns, the child has been "reaped" # when here, the child process has finished. ... ---- 2. Don't care about the child process finishing ---- $SIG{CHLD}='IGNORE'; # see the perlipc(1) man page for this... if (fork()==0) { do child stuff... exit; } continue in parent.... ---- If you don't do either of wait() or set the signal handler, then the child will remain a ZombieProcess.
8 pages link to
SIGCHLD
:
ZombieProcess
sigaction(2)
execve(2)
wait4(2)
exit(2)
Children
Signal
JobControl