aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/include/llvm/Support/FileSystem.h
diff options
context:
space:
mode:
authorshadchin <shadchin@yandex-team.ru>2022-02-10 16:44:30 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:30 +0300
commit2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch)
tree012bb94d777798f1f56ac1cec429509766d05181 /contrib/libs/llvm12/include/llvm/Support/FileSystem.h
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/include/llvm/Support/FileSystem.h')
-rw-r--r--contrib/libs/llvm12/include/llvm/Support/FileSystem.h134
1 files changed, 67 insertions, 67 deletions
diff --git a/contrib/libs/llvm12/include/llvm/Support/FileSystem.h b/contrib/libs/llvm12/include/llvm/Support/FileSystem.h
index 4e3ef16c8a..bdd39d4e61 100644
--- a/contrib/libs/llvm12/include/llvm/Support/FileSystem.h
+++ b/contrib/libs/llvm12/include/llvm/Support/FileSystem.h
@@ -41,7 +41,7 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ErrorOr.h"
-#include "llvm/Support/FileSystem/UniqueID.h"
+#include "llvm/Support/FileSystem/UniqueID.h"
#include "llvm/Support/MD5.h"
#include <cassert>
#include <cstdint>
@@ -1118,43 +1118,43 @@ Expected<file_t>
openNativeFileForRead(const Twine &Name, OpenFlags Flags = OF_None,
SmallVectorImpl<char> *RealPath = nullptr);
-/// Try to locks the file during the specified time.
-///
-/// This function implements advisory locking on entire file. If it returns
-/// <em>errc::success</em>, the file is locked by the calling process. Until the
-/// process unlocks the file by calling \a unlockFile, all attempts to lock the
-/// same file will fail/block. The process that locked the file may assume that
-/// none of other processes read or write this file, provided that all processes
-/// lock the file prior to accessing its content.
-///
-/// @param FD The descriptor representing the file to lock.
-/// @param Timeout Time in milliseconds that the process should wait before
-/// reporting lock failure. Zero value means try to get lock only
-/// once.
-/// @returns errc::success if lock is successfully obtained,
-/// errc::no_lock_available if the file cannot be locked, or platform-specific
-/// error_code otherwise.
-///
-/// @note Care should be taken when using this function in a multithreaded
-/// context, as it may not prevent other threads in the same process from
-/// obtaining a lock on the same file, even if they are using a different file
-/// descriptor.
-std::error_code
-tryLockFile(int FD,
- std::chrono::milliseconds Timeout = std::chrono::milliseconds(0));
-
-/// Lock the file.
-///
-/// This function acts as @ref tryLockFile but it waits infinitely.
-std::error_code lockFile(int FD);
-
-/// Unlock the file.
-///
-/// @param FD The descriptor representing the file to unlock.
-/// @returns errc::success if lock is successfully released or platform-specific
-/// error_code otherwise.
-std::error_code unlockFile(int FD);
-
+/// Try to locks the file during the specified time.
+///
+/// This function implements advisory locking on entire file. If it returns
+/// <em>errc::success</em>, the file is locked by the calling process. Until the
+/// process unlocks the file by calling \a unlockFile, all attempts to lock the
+/// same file will fail/block. The process that locked the file may assume that
+/// none of other processes read or write this file, provided that all processes
+/// lock the file prior to accessing its content.
+///
+/// @param FD The descriptor representing the file to lock.
+/// @param Timeout Time in milliseconds that the process should wait before
+/// reporting lock failure. Zero value means try to get lock only
+/// once.
+/// @returns errc::success if lock is successfully obtained,
+/// errc::no_lock_available if the file cannot be locked, or platform-specific
+/// error_code otherwise.
+///
+/// @note Care should be taken when using this function in a multithreaded
+/// context, as it may not prevent other threads in the same process from
+/// obtaining a lock on the same file, even if they are using a different file
+/// descriptor.
+std::error_code
+tryLockFile(int FD,
+ std::chrono::milliseconds Timeout = std::chrono::milliseconds(0));
+
+/// Lock the file.
+///
+/// This function acts as @ref tryLockFile but it waits infinitely.
+std::error_code lockFile(int FD);
+
+/// Unlock the file.
+///
+/// @param FD The descriptor representing the file to unlock.
+/// @returns errc::success if lock is successfully released or platform-specific
+/// error_code otherwise.
+std::error_code unlockFile(int FD);
+
/// @brief Close the file object. This should be used instead of ::close for
/// portability. On error, the caller should assume the file is closed, as is
/// the case for Process::SafelyCloseFileDescriptor
@@ -1166,35 +1166,35 @@ std::error_code unlockFile(int FD);
/// means that the filesystem may have failed to perform some buffered writes.
std::error_code closeFile(file_t &F);
-/// RAII class that facilitates file locking.
-class FileLocker {
- int FD; ///< Locked file handle.
- FileLocker(int FD) : FD(FD) {}
- friend class llvm::raw_fd_ostream;
-
-public:
- FileLocker(const FileLocker &L) = delete;
- FileLocker(FileLocker &&L) : FD(L.FD) { L.FD = -1; }
- ~FileLocker() {
- if (FD != -1)
- unlockFile(FD);
- }
- FileLocker &operator=(FileLocker &&L) {
- FD = L.FD;
- L.FD = -1;
- return *this;
- }
- FileLocker &operator=(const FileLocker &L) = delete;
- std::error_code unlock() {
- if (FD != -1) {
- std::error_code Result = unlockFile(FD);
- FD = -1;
- return Result;
- }
- return std::error_code();
- }
-};
-
+/// RAII class that facilitates file locking.
+class FileLocker {
+ int FD; ///< Locked file handle.
+ FileLocker(int FD) : FD(FD) {}
+ friend class llvm::raw_fd_ostream;
+
+public:
+ FileLocker(const FileLocker &L) = delete;
+ FileLocker(FileLocker &&L) : FD(L.FD) { L.FD = -1; }
+ ~FileLocker() {
+ if (FD != -1)
+ unlockFile(FD);
+ }
+ FileLocker &operator=(FileLocker &&L) {
+ FD = L.FD;
+ L.FD = -1;
+ return *this;
+ }
+ FileLocker &operator=(const FileLocker &L) = delete;
+ std::error_code unlock() {
+ if (FD != -1) {
+ std::error_code Result = unlockFile(FD);
+ FD = -1;
+ return Result;
+ }
+ return std::error_code();
+ }
+};
+
std::error_code getUniqueID(const Twine Path, UniqueID &Result);
/// Get disk space usage information.