[libc++] Better implementations of filesystem::copy_file

Hi all,

I’m trying to put the finishing touches on Libc++'s filesystem implementation. One such point of polish is copy_file. The current implementation is as naive as possible. I would like to optimize it.

Under Linux, we should have sendfile available. On BSD systems sendfile seems to be something entirely different.

So I proffer the question to the brilliant LLVM community What’s the best way to optimize copying a file? Platform specific suggestions are more than welcomed.


Hi Eric,

Hi Tim,

Thanks for the input. copyfile is perfect. So libc++ can use sendfile on Linux, copyfile on OS X.

Does anybody know some FreeBSD tricks we can use?