diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-06 17:37:04 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2014-03-06 17:37:04 +0000 |
commit | 2eb8d02622d7be54fe593425485b2e6a9c4c7d46 (patch) | |
tree | 2dab01896bb3cf30cc0ec0274e60c0ad5afddeed /llvm/lib/Support/LockFileManager.cpp | |
parent | ec9dac2579f621b250a8596dde378c421b72f437 (diff) | |
download | bcm5719-llvm-2eb8d02622d7be54fe593425485b2e6a9c4c7d46.tar.gz bcm5719-llvm-2eb8d02622d7be54fe593425485b2e6a9c4c7d46.zip |
[Support/LockFileManager] Use symbolic link for the lock file.
Hard links do not work on SMB network directories, and it causes us to fail
to build clang module files if the module cache is in such a directory.
rdar://15944959
llvm-svn: 203137
Diffstat (limited to 'llvm/lib/Support/LockFileManager.cpp')
-rw-r--r-- | llvm/lib/Support/LockFileManager.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/llvm/lib/Support/LockFileManager.cpp b/llvm/lib/Support/LockFileManager.cpp index 61afb79fb22..acb310efeec 100644 --- a/llvm/lib/Support/LockFileManager.cpp +++ b/llvm/lib/Support/LockFileManager.cpp @@ -115,24 +115,15 @@ LockFileManager::LockFileManager(StringRef FileName) } } - // Create a hard link from the lock file name. If this succeeds, we're done. + // 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 - = sys::fs::create_hard_link(UniqueLockFileName.str(), + = sys::fs::create_symbolic_link(UniqueLockFileName.str(), LockFileName.str()); if (EC == errc::success) return; - // Creating the hard link failed. - -#ifdef LLVM_ON_UNIX - // The creation of the hard link may appear to fail, but if stat'ing the - // unique file returns a link count of 2, then we can still declare success. - struct stat StatBuf; - if (stat(UniqueLockFileName.c_str(), &StatBuf) == 0 && - StatBuf.st_nlink == 2) - return; -#endif - // Someone else managed to create the lock file first. Wipe out our unique // lock file (it's useless now) and read the process ID from the lock file. sys::fs::remove(UniqueLockFileName.str()); |