[Adium-devl] rev 19069 - in branches/adium-1.0/Plugins/Gaim Service: . Libgaim.framework/Versions/A/Headers
Graham Booker
adium at cod3r.com
Sun Feb 25 14:35:34 UTC 2007
On Feb 24, 2007, at 8:33 PM, Evan Schoenberg wrote:
>
> On Feb 24, 2007, at 9:16 PM, Peter Hosey wrote:
>
>> On Feb 24, 2007, at 15:21:40, Evan Schoenberg wrote:
>>> dnssrv still uses fork()... I don't know if it creates zombies,
>>> too, or not.
>>
>> Only if it doesn't call some member of the wait(2) family.
>>
>> x-man-page://2/wait (in case anyone needs it)
>
> No member of the wait() family is called in dnssrv.c... is standard
> practice that it should be used somewhere, then?
>
There are 3 ways to fix this.
1) Use a double fork method, where the child forks again and then
immediately exist. The parent can block on a wait here because all
the first child does before exit is a fork. This means the child of
the child has its parent exit, and so it then becomes the child of
init (or I expect launchd in OS X), which calls wait periodically.
This method is the care-free method.
2) The parent has a signal handler which detects a child's exit and
handles it appropriately. (This is the zombie killer).
3) The parent calls wait when the child exist.
I suggest we do number 3 here. Unlike the DNS lookups, we know
exactly when the child exist. The DNS lookups re-use the children to
do more lookups later, so the exact time of the child's death is not
known, but here, one lookup is done, and then child sends its data,
cleans up its memory, then exits. The parent then proceeds to read
all its data. If the parent simply calls wait at this point, it will
catch the child's death. It would need to store the pid in the
_GaimSrvQueryData struct or something, so it can call waitpid and
make sure it gets the correct one. I could code this up pretty
quickly this afternoon if you like.
> -Evan
- Graham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://adium.im/pipermail/devel_adium.im/attachments/20070225/a5a75975/attachment-0001.html>
More information about the devel
mailing list