Uses the /proc/self/fd trick, which does not work on Darwin.
Pass the "flags" parameter to the lower layer syscall. This makes Apple applications being able to successfully save data.