Include <sys/socket.h> as required.

The msghdr structure used in
static yerr_t _command_list_loop(void*,ybin_t,ybin_t)
is defined in <sys/socket.h>.

Fixes build error on FreeBSD.
Implement const char *get_self_path() for FreeBSD.

Each platform offers a different API for reading
the path to the executable file. On FreeBSD this
path is readable through a sysctl MIB.
Only include <linux/limits> on Linux.

The <linux/limits.h> header is Linux specific and
src/server/server.c compiles on FreeBSD without
including this header.
Add automatic fallback from O_DSYNC to O_SYNC.

Some platforms (e.g. FreeBSD) lack O_DSYNC.
It is easier and cleaner to detect a missing
define with ifdefs than with make.