Fix fatal error on Mac OS X - redmine 6578

*BSD use unsigned long as second argument to ioctl() while POSIX
 specifies *signed* int.

(cherry picked from commit f0ea3aca87c38107532a0f87be8b047e3bbbeb08)
Try to log TLS errors that are easier to consume.

(cherry picked from commit e3ffa77402d43ae8e31264f0b8cdc1eccb2ee9c0)
Do not exit cf-serverd on SIGPIPE.

(cherry picked from commit d834ac793e5ad6045ebf7a771557e87f7acba257)
CFE2 had no extra protocol field, it defaulted to community.

(cherry picked from commit ff300127cd20110ce68fa4daaa084ba4d39d6b91)