Still problems with Nagios 2.9 and NDO under Solaris 8

Ethan Galstad nagios at nagios.org
Fri Oct 19 18:20:07 CEST 2007


Masopust, Christian wrote:
>>>>> i'm still having problems with ndoutils under Solaris 9.
>>>>>  
>>>>> When i'm activating it (event_broker_options=-1) in nagios.cfg
>>>>> my nagios won't start anymore !!   it always stops with a 
>>>> segmentation fault!
>>>>>  
>>>>> here's the traceback of the dump:
>>>>>  
>>>>> (gdb) bt
>>>>> #0  0xff1b3288 in strlen () from /usr/lib/libc.so.1
>>>>> #1  0xff10bcbc in ndo_escape_buffer (buffer=Cannot access 
>>>> memory at address 0x44
>>>>> ) at io.c:424
>>>>> #2  0xff104788 in ndomod_write_object_config 
>>>> (config_type=1) at ndomod.c:3183
>>>>> #3  0xff103d30 in ndomod_write_config (config_type=1) at 
>>>> ndomod.c:2999
>>>>> #4  0xff103b44 in ndomod_broker_data (event_type=7, 
>>>> data=0xffbef954) at ndomod.c:2940
>>>>> #5  0x0001d038 in neb_make_callbacks ()
>>>>> #6  0x0001ca38 in broker_program_state ()
>>>>> #7  0x0001b67c in main ()
>>>>>
>>>>> is there anyone who could shed a little lite on this ??
>>>>>  
>>>> Not really. The program receives a SIGSEGV in 
>>>> ndo_escape_buffer because it gets
>>>> passed an invalid pointer (memory address 0x44 is not 
>>>> available to programs).
>>>>
>>>> Why it gets passed a bogus address on Solaris is a mystery 
>> to me, as
>>>> contact_struct->name is located at relative address 0 within 
>>>> the contact_struct
>>>> data structure (unless your compiler re-arranges it ofcourse).
>>>>
>>> Hello Andreas,
>>>
>>> that's real funny.... i tried yesterday the same sources on a RHEL 4
>>> system and it works perfectly !
>>>
>>> and also funny is that the SIGSEGV on Solaris 8 is there whether i
>>> compile Nagios and NDO with gcc (4.1.2) or Sun-Studio 11 ...
>>>
>>> isn't there anyone who also has Nagios running on Solaris 8 ??  :-))
>>>
>> Probably, but it's unlikely that many of those run NDOUtils compiled
>> with Solaris' compiler.
>>
>> -- 
> 
> Hello Andreas,
> 
> I'm not (totally) sure about this as i already tried to compile Nagios
> and NDOUtils with SUN-Studio compilers (Studio 11 for Solaris 8) and
> get the same results.
> 
> Maybe you remember one of my last mails (from April this year)...
> 
>> 1. error during compile: Solaris 8 doesn't provide the SUN_LEN macro, so i
>>    copied it from one of my Linux - systems   ---> compile ok.
>> 2. error during linking: Solaris 8 doesn't provide "strtof". I found the
>>    source for strtof on www.koders.com and added it ---> link ok
> 
> this is what i did:
> 
> 1. add the following to include/config.h (for ndoutils):
> #ifndef SUN_LEN
> #define SUN_LEN(sunp) ((size_t)((struct sockaddr_un *)0)->sun_path + strlen((sunp)->sun_path))
> #endif
> 
> 2. add the following file to src (and add it to the makefile) to get "strtof":
> bash-2.03# cat strtof.c
> #include <string.h>
> #include <stdlib.h>
> #include <ctype.h>
> 
> float strtof(const char* s, char** endptr) {
>     register const char*  p     = s;
>     register float        value = 0.;
>     int                   sign  = +1;
>     float                 factor;
>     unsigned int          expo;
> 
>     while ( isspace(*p) )
>         p++;
> 
>     switch (*p) {
>     case '-': sign = -1;
>     case '+': p++;
>     default : break;
>     }
> 
>     while ( (unsigned int)(*p - '0') < 10u )
>         value = value*10 + (*p++ - '0');
> 
>     if ( *p == '.' ) {
>         factor = 1.;
> 
>         p++;
>         while ( (unsigned int)(*p - '0') < 10u ) {
>             factor *= 0.1;
>             value  += (*p++ - '0') * factor;
>         }
>     }
> 
>     if ( (*p | 32) == 'e' ) {
>         expo   = 0;
>         factor = 10.L;
> 
>         switch (*++p) { 
>         case '-': factor = 0.1;
>         case '+': p++;
>                   break;
>         case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9':
>                   break;
>         default : value = 0.L;
>                   p     = s;
>                   goto done;
>         }
> 
>         while ( (unsigned int)(*p - '0') < 10u )
>             expo = 10 * expo + (*p++ - '0');
> 
>         while ( 1 ) {
>             if ( expo & 1 )
>                 value *= factor;
>             if ( (expo >>= 1) == 0 )
>                 break;
>             factor *= factor;
>         }
>     }
> 
> done:
>     if ( endptr != NULL )
>         *endptr = (char*)p;
> 
>     return value * sign;
> }
> 
> 
> any ideas more?   especially.... is my definition for SUN_LEN correct?
> and... does anybody have a (maybe) better "strtof" for Solaris 8 ?
> 
> Thanks again!
> Christian
> 

I'll be adding autconf detection of strtof() and SUN_LEN defs shortly. 
If strtof() doesn't exist, I'll just back off and use strtod(), which 
should be acceptable.  Hopefully that will help solve some issues on 
Solaris 8.


Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/




More information about the Developers mailing list