wait()

Michal Kubecek mike na mk-sys.cz
Pátek Březen 10 15:20:48 CET 2006


On Fri, Mar 10, 2006 at 01:41:36PM +0100, Ing. Pavel PaJaSoft Janoušek wrote:
> > Protože by se mu v systému hromadily zombie.
> 
> Ono je to ještě horší - viz man 2 signal: According  to  POSIX
> (3.3.1.3)  it  is  unspecified  what happens when SIGCHLD is set to
> SIG_IGN.  Here the BSD and  SYSV  behaviours differ, causing  BSD
> software  that  sets the action for SIGCHLD to SIG_IGN to fail on
> Linux.

Tak jsem našel ještě něco jiného ve waitpid(2):

  POSIX.1-2001  specifies  that  if  the disposition of SIGCHLD is set
  to SIG_IGN or the SA_NOCLDWAIT flag is set for SIGCHLD (see
  sigaction(2)), then children that terminate do not become zombies and
  a call to wait() or waitpid() will block until all children have
  terminated,  and then fail  with  errno set to ECHILD.  (The original
  POSIX standard left the behaviour of setting SIGCHLD to SIG_IGN
  unspecified.)  Linux  2.6 con- forms  to  this  specification.
  However, Linux 2.4 (and earlier) does not: if a wait() or waitpid()
  call  is  made  while  SIGCHLD  is being ignored,  the  call  behaves
  just  as  though  SIGCHLD  were not being ignored, that is, the call
  blocks until the next child terminates  and then returns the process
  ID and status of that child.

Člověk se učí celý život...

							  Michal Kubeček



Další informace o konferenci Linux