various posix compilation fixes