need to include <errno.h> on OSX