#include "llvm/Support/LockFileManager.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/ExponentialBackoff.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h"
#include "llvm/Support/raw_ostream.h"
#include <cerrno>
#include <chrono>
#include <ctime>
#include <memory>
#include <sys/stat.h>
#include <sys/types.h>
#include <system_error>
#include <thread>
#include <tuple>
#ifdef _WIN32
#include <windows.h>
#endif
#if LLVM_ON_UNIX
#include <unistd.h>
#endif
#if defined(__APPLE__) && defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1050)
#define USE_OSX_GETHOSTUUID …
#else
#define USE_OSX_GETHOSTUUID …
#endif
#if USE_OSX_GETHOSTUUID
#include <uuid/uuid.h>
#endif
usingnamespacellvm;
std::optional<std::pair<std::string, int>>
LockFileManager::readLockFile(StringRef LockFileName) { … }
static std::error_code getHostID(SmallVectorImpl<char> &HostID) { … }
bool LockFileManager::processStillExecuting(StringRef HostID, int PID) { … }
namespace {
class RemoveUniqueLockFileOnSignal { … };
}
LockFileManager::LockFileManager(StringRef FileName)
{ … }
LockFileManager::LockFileState LockFileManager::getState() const { … }
std::string LockFileManager::getErrorMessage() const { … }
LockFileManager::~LockFileManager() { … }
LockFileManager::WaitForUnlockResult
LockFileManager::waitForUnlock(const unsigned MaxSeconds) { … }
std::error_code LockFileManager::unsafeRemoveLockFile() { … }