+static std::error_code getHostID(SmallVectorImpl<char> &HostID) {
+ HostID.clear();
+
+#if USE_OSX_GETHOSTUUID
+ // On OS X, use the more stable hardware UUID instead of hostname.
+ struct timespec wait = {1, 0}; // 1 second.
+ uuid_t uuid;
+ if (gethostuuid(uuid, &wait) != 0)
+ return std::error_code(errno, std::system_category());
+
+ uuid_string_t UUIDStr;
+ uuid_unparse(uuid, UUIDStr);
+ StringRef UUIDRef(UUIDStr);
+ HostID.append(UUIDRef.begin(), UUIDRef.end());
+
+#elif LLVM_ON_UNIX
+ char HostName[256];
+ HostName[255] = 0;
+ HostName[0] = 0;
+ gethostname(HostName, 255);
+ StringRef HostNameRef(HostName);
+ HostID.append(HostNameRef.begin(), HostNameRef.end());
+
+#else
+ StringRef Dummy("localhost");
+ HostID.append(Dummy.begin(), Dummy.end());
+#endif
+
+ return std::error_code();
+}
+
+bool LockFileManager::processStillExecuting(StringRef HostID, int PID) {