[collectd] Collectd on freebsd 7x (specificially 7.2)

Brett Hawn brett.hawn at gmail.com
Sat Jun 20 18:40:32 CEST 2009


Florian Forster wrote:
> thanks for debugging this problem that far :) 262145 in hex is 0x40001,
> which isn't really related to 6 in any obvious way. The code was
> originally written for Mac OS X, so it's well possible that FreeBSD
> somehow treats the `socket protocol' differently from Mac OS X..
>
> There is another field burried deep within that structure,
>   (struct xsocket *)->xso_so->so_proto->pr_protocol
> in our case that's:
>   so->xso_so->so_proto->pr_protocol
>
> Could you maybe check the value of that member? From what I see it
> *should* be identical to (struct xsocket *)->xso_protocol, but you never
> know..
>
> Regards,
> -octo
>   
Unfortunately it appears to be blowing up nicely

I included <sys/protosw.h>

and then

    if (so->xso_protocol != 262145)
      continue;

     printf("Value of so->xso_so->so_proto->pr_protocol is %u", 
so->xso_so->so_proto->pr_protocol);

    /* Ignore PCBs which were freed during copyout. */
    if (inp->inp_gencnt > in_orig->xig_gen)
      continue;


cds794# gdb collectd
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) run -f
Starting program: /usr/local/collectd/sbin/collectd -f
[New LWP 100199]
[New Thread 0x800d020b0 (LWP 100199)]
[New Thread 0x800d023d0 (LWP 100049)]
[New Thread 0x800d02560 (LWP 100215)]
[New Thread 0x800d026f0 (LWP 100293)]
[New Thread 0x800d02880 (LWP 100294)]
[New Thread 0x800d02a10 (LWP 100295)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x800d02560 (LWP 100215)]
0x0000000800f0318b in conn_read () at tcpconns.c:608
608          printf("Value of so->xso_so->so_proto->pr_protocol is %u", 
so->xso_so->so_proto->pr_protocol);
(gdb) backtrace
#0  0x0000000800f0318b in conn_read () at tcpconns.c:608
#1  0x000000000040b032 in plugin_read_thread (args=Variable "args" is 
not available.
) at plugin.c:365
#2  0x00000008006584d1 in pthread_getprio () from /lib/libthr.so.3
#3  0x0000000000000000 in ?? ()
Error accessing memory address 0x7fffff9fe000: Bad address.

*boom*



More information about the collectd mailing list