SIGCHLD


On POSIX-compliant platforms, 'SIGCHLD' is the signal thrown by computer programs when a child process terminates. The symbolic constant for SIGCHLD is defined in the header file signal.h. Symbolic signal names are used because signal numbers can vary across platforms.
On Linux, 'SIGCLD' is a synonym for SIGCHLD.

Contents
Etymology
Usage
References

Etymology


''SIG'' is a common prefix for signal names. ''CHLD'' and ''CLD'' are abbreviations for ''child''.

Usage


In Unix, a process can have children, created by fork or similar system calls. When the child terminates a SIGCHLD signal is sent to the parent. By default the signal is ignored and a zombie process is created[1]. The parent must install a handler to act on the signal. Zombies can be avoided on some Unix platforms by explicitly ignoring SIGCHLD[2][3]. This is shown in various languages in the table below. However, installing a signal handler for SIGCHLD and calling wait remains the most portable way to avoid zombies.
{| class="wikitable"
|-
! Language
! Syntax
|-
| Perl
| $SIG{'CHLD'}="IGNORE";
|-
| Python
| signal.signal(signal.SIGCHLD, signal.SIG_IGN)
|-
| PHP
| pcntl_signal(SIGCHLD, SIG_IGN);
|}

References


1. Advanced Programming in the UNIX Environment - W. Stevens
2. http://perldoc.perl.org/perlipc.html#Signals
3.


This article provided by Wikipedia. To edit the contents of this article, click here for original source.

psst.. try this: add to faves