port to FreeBSD 10 & OSX 10.9.5

I have verified that this works on FreeBSD 10.  I left it running overnight with no issues.

On OS X I can build it, but it is failing with errno 65 'no route to host'? even though it actually works.
I can route around the issue by setting errno=0 just before the reconnect checks in the two clients.
I've done some instrumentation to try to discover which syscall is setting errno, but I've run out of time to work on this today.

Please do not force-set this flag either...if someone is running on FreeBSD on non-x86 this stuff probably wont run.