llvm-project/libcxx
Eric Fiselier 7c0ed44db0 Implement a better copy_file.
This patch improves both the performance, and the safety of the
copy_file implementation.

The performance improvements are achieved by using sendfile on
Linux and copyfile on OS X when available.

The TOCTOU hardening is achieved by opening the source and
destination files and then using fstat to check their attributes to
see if we can copy them.

Unfortunately for the destination file, there is no way to open
it without accidentally creating it, so we first have to use
stat to determine if it exists, and if we should copy to it.
Then, once we're sure we should try to copy, we open the dest
file and ensure it names the same entity we previously stat'ed.

llvm-svn: 337649
2018-07-22 02:00:53 +00:00
..
benchmarks Add new string benchmarks 2018-07-10 04:11:22 +00:00
cmake [CMake] Install C++ ABI headers into the right location 2018-07-20 22:45:24 +00:00
docs [libc++] Take 2: Replace uses of _LIBCPP_ALWAYS_INLINE by _LIBCPP_INLINE_VISIBILITY 2018-07-11 23:14:33 +00:00
fuzzing Wrote my own version of is_permutation; that was dominating the timings 2018-01-19 03:17:45 +00:00
include Implement a better copy_file. 2018-07-22 02:00:53 +00:00
lib [libc++] Allow running ABI list tests with different ABI versions 2018-07-19 18:02:50 +00:00
src Implement a better copy_file. 2018-07-22 02:00:53 +00:00
test Implement a better copy_file. 2018-07-22 02:00:53 +00:00
utils Remove BUILD file from google-benchmark 2018-07-10 13:25:26 +00:00
www [libc++] Implement Directory Entry Caching -- Sort of. 2018-07-20 01:22:32 +00:00
.arcconfig [libcxx] Set up .arcconfig to point to new Diffusion CXX repository 2017-12-04 17:55:28 +00:00
.clang-format Make clang-format use C++03 syntax 2017-04-15 02:45:43 +00:00
.gitignore Implement N4606 optional 2016-10-12 07:46:20 +00:00
CMakeLists.txt [CMake] Set per-runtime library directory suffix in runtimes build 2018-07-10 19:13:33 +00:00
CREDITS.TXT Try again, this time with the correct address 2017-12-29 19:26:53 +00:00
LICENSE.TXT Update year to 2017 2017-01-03 11:20:43 +00:00
NOTES.TXT Reland "Use custom command and target to install libc++ headers" 2018-06-12 03:10:02 +00:00
TODO.TXT Add list of filesystem NB comments to TODO.TXT so they can be tracked separately 2017-03-06 21:23:36 +00:00
appveyor-reqs-install.cmd Update Clang version on Appveyor bots 2018-04-04 04:33:09 +00:00
appveyor.yml Rename Appveyor install helper script. 2017-05-10 02:43:02 +00:00