get_hostname implemented for POSIX systems, other compilation fixes