AW: Nagios 2.0b4 restart issue
Andreas Ericsson
ae at op5.se
Tue Nov 29 13:27:07 CET 2005
Thibault Genessay wrote:
> Andreas Ericsson wrote:
>
>> No it's not. Multiple instances has absolutely nothing to do with what
>> the shell returns when asked to run a program. In this case, it does
>>
>> result = execve(argv[0], argv, envp);
>> /* execve() only returns on errors, so hint what went wrong */
>> exit (-errno);
>>
>> and since ENOENT == 2 this results in a return code of -127 on all
>> architectures that implement the two-complement bit pattern.
>>
> Andreas, I'm getting away from the initial topic, but I've tryed the
> following code:
> #include <errno.h>
> int main(int argc, char* argv[])
> {
> int dontcare = execv(argv[1], argv);
> printf("Returning -(%d) to the shell\n", errno);
> exit(-errno);
> }
> Then I called it with something stupid (e.g. ./a.out does-not-exist) and
> echoed the $?, which happens to be 254. Seems to be something like
> signed/unsigned issue.
The shell variable $? is always unsigned, but when a program fetches the
exit status it can choose to use it as signed rather than casting it.
> Anyway this program returns 254 on my x86 box so the 127 value mentioned
> in this thread might come from somewhere else.
>
Nopes. (signed)-127 has the exact same bit-pattern as (unsigned)254 for
an 8 bit wide variable.
> As for Radkon's problem, I remember having had to kill -9 Nagios'
> processes from time to time when checking/debuging the configuration and
> NEB and playing too intensively with the [re]start/stop script -- but
> this did not yield 127 errors.
Nor should it. I expect something else entirely is borked on his system.
--
Andreas Ericsson andreas.ericsson at op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
More information about the Developers
mailing list