It looks like the problem is the value of MAXHOSTNAMELEN from
<sys/param.h>--this program prints 64 on linux but 256 on kfreebsd:
#include <sys/param.h>
#include <fcntl.h>
#include <stdio.h>
int main() {
printf("%d\n", (int) MAXHOSTNAMELEN);
return 0;
}
As you can see, the structure sizes won't work out if MAXHOSTNAMELEN is
256...
So I'd first try unconditionally defining MAXHOSTNAMELEN to 64.
Jeff