[Xfce4-commits] r19323 - libxfcegui4/trunk/libxfcegui4

Jasper Huijsmans jasper at xfce.org
Sat Jan 7 11:18:32 CET 2006


Brian J. Tarricone schreef:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 1/7/2006 2:00 AM, Jasper Huijsmans wrote:
>> Brian J. Tarricone schreef:
>>
>>> On 1/7/2006 1:33 AM, Jasper Huijsmans wrote:
>>>
>>>> Brian J. Tarricone schreef:
>>>> ...
>>>>
>>>>
>>>>>> SIGCHLD is ignored by default, isn't it?
>>>>> Nope.
>>>> Hmm, according to the glibc info page, it is.
>>> Then it lies.  Try this awesome little one-liner:
>>>
>>> void main() { switch(fork()) { case -1: exit(1); case 0: _exit(0);
>>> default: while(1); } }
>>>
>>> Run it, and you'll see that a zombie is left.  At least it is on my box
>>> (glibc 2.3.5).  I get this:
>>>
>>> brian at kelnos ~ $ ./testsigchld &
>>> [1] 17421
>>> brian at kelnos ~ $ ps
>>>  PID TTY          TIME CMD
>>> 17312 pts/1    00:00:00 bash
>>> 17421 pts/1    00:00:00 testsigchld
>>> 17422 pts/1    00:00:00 testsigchld <defunct>
>>> 17423 pts/1    00:00:00 ps
>> That is exactly because SIGCHLD is not handled, or am I missing something?
> 
> "Not handled" and "ignored" aren't the same thing.  "Not handled" (the
> default) will leave zombies when the children exit, but "ignored" (via
> signal(SIGCHLD, SIG_IGN)) won't.
> 
>> I thought Danny added a callback, because SIGCHLD would stop the 
>> program. Did I read that wrong?
> 
> SIGCHLD shouldn't stop the parent.  IIRC, if you don't handle it, you
> just get zombie children.
> 

Agreed. I slightly misunderstaood what Danny was trying to do.

However, from the glib documentation:

  G_SPAWN_DO_NOT_REAP_CHILD 	the child will not be automatically
  you must call waitpid() or handle SIGCHLD yourself, or the child will
  become a zombie.

So, only if we use this flag do we need to close the pid.

	Jasper



More information about the Xfce4-dev mailing list