wait()

Jan Kasprzak kas na fi.muni.cz
Pátek Březen 10 23:33:55 CET 2006


Michal Kubecek wrote:
: 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...

	Jo, tohle je spravne reseni. Kdysi to byvalo popsane i v sigaction(2),
ale ted se divam, ze tam vubec SA_NOCLDWAIT neni. Kazdopadne fungovat by to
melo (Stevens tohleto uvadi jako doporuceny postup, kdyz na UNIXu nechcete
cekat na potomky a nechcete z nich mit zombie).

-Y.

-- 
| Jan "Yenya" Kasprzak  <kas at {fi.muni.cz - work | yenya.net - private}> |
| GPG: ID 1024/D3498839      Fingerprint 0D99A7FB206605D7 8B35FCDE05B18A5E |
| http://www.fi.muni.cz/~kas/    Journal: http://www.fi.muni.cz/~kas/blog/ |
> Specs are a basis for _talking_about_ things. But they are _not_ a basis <
> for implementing software.                              --Linus Torvalds <


Další informace o konferenci Linux