[Nagiosplug-devel] check_dns: DNS WARNING - nslookup returned error status
Andreas Ericsson
ae at op5.se
Fri Sep 2 06:46:05 CEST 2005
sean finney wrote:
> (sending a second copy to the list, the first got caught with too many
> cc's)
>
> On Fri, Sep 02, 2005 at 02:23:16PM +0200, Peter Pramberger wrote:
>
>>Please keep in mind that ECHILD is an error condition - there was no process
>>found to check for. status' value is not defined after the call to waitpid, so
>>the result of WIFEXITED is unpredictable.
>
>
> yes, this is why simply changing to the switch statement proposed by dag
> would not work. the question is, how do we get at the status in this
> case?
>
> this is from r'ing tfm for sigaction(2):
>
> POSIX.1-1990 disallowed setting the action for SIGCHLD to SIG_IGN.
> POSIX.1-2001 allows this possibility, so that ignoring SIGCHLD can be
> used to prevent the creation of zombies (see wait(2)). Nevertheless,
> the historical BSD and System V behaviours for ignoring SIGCHLD differ,
> so that the only completely portable method of ensuring that terminated
> children do not become zombies is to catch the SIGCHLD signal and per-
> form a wait(2) or similar.
>
> so what, redhat is now defaulting to having that set? i think i see a
> way around this, but i'm not sure:
>
> - set a signal handler for SIGCHLD
> - when SIGCHLD is thrown, we do exactly the opposite from the above, and
> *not* call any wait functions.
>
I wrote a test-program for this. On FC3 with linux-2.6.12-1372 (weird
patch-number, I know), when SIGCHLD is explicitly set to SIG_IGN, the
children exit immediately and nothing good ever comes of it. When no
sighandlers are installed, children hang around for the waitpid(2) call.
Setting SIGCHLD to SIG_IGN is the default, according to signal(7)
> i think that should leave the child as a zombie, for our later call to
> waitpid.
>
In theory, it should work. In reality, it doesn't (FC3). I'm not sure
why yet.
If anyone's interested in the test-program (some non-working code is
commented out), email me off-list and I'll send it to you. oss.op5.se is
currently down, or I'd post it there (some jackass hit a cable with a 4
tonne construction machine).
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Lead Developer
More information about the Devel
mailing list