diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-11 18:40:24 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-03-11 18:40:24 +0000 |
commit | 83f858e578d3efa07549c1757d675293bc844b9a (patch) | |
tree | e1cfec2ace6af51b8973a1b30d50896d7c470d12 /llvm/lib/Support/LockFileManager.cpp | |
parent | 698a5bdbba4c01c39a03b23280cd95ecbf153164 (diff) | |
download | bcm5719-llvm-83f858e578d3efa07549c1757d675293bc844b9a.tar.gz bcm5719-llvm-83f858e578d3efa07549c1757d675293bc844b9a.zip |
Cleanup the interface for creating soft or hard links.
Before this patch the unix code for creating hardlinks was unused. The code
for creating symbolic links was implemented in lib/Support/LockFileManager.cpp
and the code for creating hard links in lib/Support/*/Path.inc.
The only use we have for these is in LockFileManager.cpp and it can use both
soft and hard links. Just have a create_link function that creates one or the
other depending on the platform.
llvm-svn: 203596
Diffstat (limited to 'llvm/lib/Support/LockFileManager.cpp')
-rw-r--r-- | llvm/lib/Support/LockFileManager.cpp | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index b45fcbca2e2..ba1047b88ac 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -67,22 +67,6 @@ bool LockFileManager::processStillExecuting(StringRef Hostname, int PID) { return true; } -#if LLVM_ON_UNIX -static error_code unix_create_symbolic_link(const Twine &to, - const Twine &from) { - // Get arguments. - SmallString<128> from_storage; - SmallString<128> to_storage; - StringRef f = from.toNullTerminatedStringRef(from_storage); - StringRef t = to.toNullTerminatedStringRef(to_storage); - - if (::symlink(t.begin(), f.begin()) == -1) - return error_code(errno, system_category()); - - return error_code::success(); -} -#endif - LockFileManager::LockFileManager(StringRef FileName) { this->FileName = FileName; @@ -132,20 +116,9 @@ LockFileManager::LockFileManager(StringRef FileName) } while (1) { -#if LLVM_ON_UNIX - // Create a symbolic link from the lock file name. If this succeeds, we're - // done. Note that we are using symbolic link because hard links are not - // supported by all filesystems. - error_code EC - = unix_create_symbolic_link(UniqueLockFileName.str(), - LockFileName.str()); -#else - // We can't use symbolic links for windows. - // Create a hard link from the lock file name. If this succeeds, we're done. - error_code EC - = sys::fs::create_hard_link(UniqueLockFileName.str(), - LockFileName.str()); -#endif + // Create a link from the lock file name. If this succeeds, we're done. + error_code EC = + sys::fs::create_link(UniqueLockFileName.str(), LockFileName.str()); if (EC == errc::success) return; |