POSIX wrapper. Some cleanup.