threading: Include fcntl.h on POSIX systems

This is where O_CREAT and O_EXCL are defined.