summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2019-04-18 01:21:10 +0000
committerAdrian Prantl <aprantl@apple.com>2019-04-18 01:21:10 +0000
commit00d97ea2021f8636acec81146ae7ca50d44c8d0a (patch)
tree86eb4051f042eed383c1aad93b4f590912e7952c /llvm/lib/Support/Unix
parentb7bdb8cf33cb8e4a1a940fab823ae7e0ff394e87 (diff)
downloadbcm5719-llvm-00d97ea2021f8636acec81146ae7ca50d44c8d0a.tar.gz
bcm5719-llvm-00d97ea2021f8636acec81146ae7ca50d44c8d0a.zip
Revert Implement sys::fs::copy_file using the macOS copyfile(3) API to support APFS clones.
This reverts r358628 (git commit 91a06bee788262a294527b815354f380d99dfa9b) while investigating a crash reproducer bot failure. llvm-svn: 358634
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Path.inc51
1 files changed, 0 insertions, 51 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 27db41afea2..05ccc6cc5e4 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -37,7 +37,6 @@
#ifdef __APPLE__
#include <mach-o/dyld.h>
#include <sys/attr.h>
-#include <copyfile.h>
#elif defined(__DragonFly__)
#include <sys/mount.h>
#endif
@@ -1114,55 +1113,5 @@ void system_temp_directory(bool ErasedOnReboot, SmallVectorImpl<char> &Result) {
} // end namespace path
-namespace fs {
-
-#ifdef __APPLE__
-/// This implementation tries to perform an APFS CoW clone of the file,
-/// which can be much faster and uses less space.
-std::error_code copy_file(const Twine &From, const Twine &To) {
- uint32_t Flag = COPYFILE_DATA;
- bool IsSymlink;
- if (std::error_code Error = is_symlink_file(From, IsSymlink))
- return Error;
-
- if (!IsSymlink)
- if (__builtin_available(macos 10.12, *))
- Flag = COPYFILE_CLONE;
-
- int Status =
- copyfile(From.str().c_str(), To.str().c_str(), /* State */ NULL, Flag);
-
- if (Status == 0)
- return std::error_code();
- return std::error_code(errno, std::generic_category());
-}
-
-/// This implementation tries to perform an APFS CoW clone of the file,
-/// which can be much faster and uses less space.
-std::error_code copy_file(const Twine &From, int ToFD) {
- uint32_t Flag = COPYFILE_DATA;
- bool IsSymlink;
- if (std::error_code Error = is_symlink_file(From, IsSymlink))
- return Error;
-
- int ReadFD;
- if (std::error_code EC = openFileForRead(From, ReadFD, OF_None))
- return EC;
-
- if (!IsSymlink)
- if (__builtin_available(macos 10.12, *))
- Flag = COPYFILE_CLONE;
-
- int Status = fcopyfile(ReadFD, ToFD, /*State*/ NULL, Flag);
-
- close(ReadFD);
- if (Status == 0)
- return std::error_code();
- return std::error_code(errno, std::generic_category());
-}
-#endif
-
-} // end namespace fs
-
} // end namespace sys
} // end namespace llvm
OpenPOWER on IntegriCloud