[collectd] collectd-4.x on OpenBSD build problem

eric fauser ef_cd at apa.at
Mon Jun 25 13:11:05 CEST 2007


Hi


 > file I found on the web the `enum NPmode' is unknown and it's
 > defined in `net/ppp_defs.h'.

thanks for spec.source .... looks good,... the if_ppp problem has gone ;)

 > > utils_dns.c:700: error: `ns_t_a' undeclared (first use in this
 > > function)

it looks like the same problem as above; openbsd does not have `enum 
ns_type' in namser.h
it has an old structure like `T_foo` and only a few return_codes (rcode_str)

i patched the source to use the `T_*` in that way and it looks good:

===SNIP utils_dns.c===

const char *qtype_str(int t)
{
    static char buf[32];
    switch (t) {
            case T_A:        return ("A");
            case T_NS:       return ("NS");
            case T_MD:       return ("MD");
            case T_MF:       return ("MF");
            case T_CNAME:    return ("CNAME");
            case T_SOA:      return ("SOA");
            case T_MB:       return ("MB");
            case T_MG:       return ("MG");
            case T_MR:       return ("MR");
            case T_NULL:     return ("NULL");
            case T_WKS:      return ("WKS");
            case T_PTR:      return ("PTR");
            case T_HINFO:    return ("HINFO");
            case T_MINFO:    return ("MINFO");
            case T_MX:       return ("MX");
            case T_TXT:      return ("TXT");
            case T_RP:       return ("RP");
            case T_AFSDB:    return ("AFSDB");
            case T_X25:      return ("X25");
            case T_ISDN:     return ("ISDN");
            case T_RT:       return ("RT");
            case T_NSAP:     return ("NSAP");
            case T_NSAP_PTR: return ("NSAP-PTR");
            case T_SIG:      return ("SIG");
            case T_KEY:      return ("KEY");
            case T_PX:       return ("PX");
            case T_GPOS:     return ("GPOS");
            case T_AAAA:     return ("AAAA");
            case T_LOC:      return ("LOC");
            case T_NXT:      return ("NXT");
            case T_EID:      return ("EID");
            case T_NIMLOC:   return ("NIMLOC");
            case T_SRV:      return ("SRV");
            case T_ATMA:     return ("ATMA");
            case T_NAPTR:    return ("NAPTR");
            case T_KX:       return ("KX");
            case T_CERT:     return ("CERT");
            case T_A6:       return ("A6");
            case T_DNAME:    return ("DNAME");
            case T_SINK:     return ("SINK");
            case T_OPT:      return ("OPT");
            case T_TSIG:     return ("TSIG");
            case T_IXFR:     return ("IXFR");
            case T_AXFR:     return ("AXFR");
            case T_MAILB:    return ("MAILB");
            case T_MAILA:    return ("MAILA");
            case T_ANY:      return ("ANY");
            // case T_ZXFR:     return ("ZXFR");
            default:
                    snprintf (buf, 32, "#%i", t);
                    buf[31] = '\0';
                    return (buf);
    }; /* switch (t) */
    /* NOTREACHED */
    return (NULL);
}

const char *rcode_str (int rcode)
{
        static char buf[32];
        switch (rcode)
        {
                case NOERROR:  return ("NOERROR");
                case FORMERR:  return ("FORMERR");
                case SERVFAIL: return ("SERVFAIL");
                case NXDOMAIN: return ("NXDOMAIN");
                case NOTIMP:   return ("NOTIMPL");
                case REFUSED:  return ("REFUSED");
                // case yxdomain: return ("YXDOMAIN");
                // case yxrrset:  return ("YXRRSET");
                // case nxrrset:  return ("NXRRSET");
                // case notauth:  return ("NOTAUTH");
                // case notzone:  return ("NOTZONE");
                // case max:      return ("MAX");
                // case badsig:   return ("BADSIG");
                // case badkey:   return ("BADKEY");
                // case badtime:  return ("BADTIME");
                default:
                        snprintf (buf, 32, "RCode%i", rcode);
                        buf[31] = '\0';
                        return (buf);
        }
        /* Never reached */
        return (NULL);
} /* const char *rcode_str (int rcode) */

===SNIP==


:( ... but now i ran into the next problem...

===make===
Making all in liboping
if /bin/sh ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H  -I. 
-I. -I.     -Wall -Werror -g -O2 -MT exec.lo -MD -MP -MF 
".deps/exec.Tpo" -c -o exec.lo exec.c;  then mv -f ".deps/exec.Tpo" 
".deps/exec.Plo"; else rm -f ".deps/exec.Tpo"; exit 1; fi
 gcc -DHAVE_CONFIG_H -I. -I. -I. -Wall -Werror -g -O2 -MT exec.lo -MD 
-MP -MF .deps/exec.Tpo -c exec.c  -fPIC -DPIC -o .libs/exec.o
exec.c: In function `exec_child':
exec.c:119: warning: implicit declaration of function `getpwnam_r'
*** Error code 1
===


i tried to patch this,... but i think theres a reason to use _r ;) 
(thread-save i think)

===SNIP exec.c ===
 struct passwd *sp_ptr;
  struct passwd sp;
  char errbuf[1024];
   
  sp_ptr = getpwnam(pl->user);
  if (sp_ptr == NULL)
  {
    ERROR ("exec plugin: No such user: `%s'", pl->user);
    exit (-1);
  }
===SNIP===


regards
eric

btw: if u like, i can give you an login to the build host running on 
openbsd4.1



More information about the collectd mailing list