aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/lib/Support/Unix/Path.inc
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/lib/Support/Unix/Path.inc
parent6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff)
downloadydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/Support/Unix/Path.inc')
-rw-r--r--contrib/libs/llvm12/lib/Support/Unix/Path.inc142
1 files changed, 71 insertions, 71 deletions
diff --git a/contrib/libs/llvm12/lib/Support/Unix/Path.inc b/contrib/libs/llvm12/lib/Support/Unix/Path.inc
index 996b8aebf6..1c2fc15fc5 100644
--- a/contrib/libs/llvm12/lib/Support/Unix/Path.inc
+++ b/contrib/libs/llvm12/lib/Support/Unix/Path.inc
@@ -33,7 +33,7 @@
#include <dirent.h>
#include <pwd.h>
-#include <sys/file.h>
+#include <sys/file.h>
#ifdef __APPLE__
#include <mach-o/dyld.h>
@@ -147,9 +147,9 @@ test_dir(char ret[PATH_MAX], const char *dir, const char *bin)
static char *
getprogpath(char ret[PATH_MAX], const char *bin)
{
- if (bin == nullptr)
- return nullptr;
-
+ if (bin == nullptr)
+ return nullptr;
+
/* First approach: absolute path. */
if (bin[0] == '/') {
if (test_dir(ret, "/", bin) == 0)
@@ -793,16 +793,16 @@ std::error_code setLastAccessAndModificationTime(int FD, TimePoint<> AccessTime,
if (::futimes(FD, Times))
return std::error_code(errno, std::generic_category());
return std::error_code();
-#elif defined(__MVS__)
- attrib_t Attr;
- memset(&Attr, 0, sizeof(Attr));
- Attr.att_atimechg = 1;
- Attr.att_atime = sys::toTimeT(AccessTime);
- Attr.att_mtimechg = 1;
- Attr.att_mtime = sys::toTimeT(ModificationTime);
- if (::__fchattr(FD, &Attr, sizeof(Attr)) != 0)
- return std::error_code(errno, std::generic_category());
- return std::error_code();
+#elif defined(__MVS__)
+ attrib_t Attr;
+ memset(&Attr, 0, sizeof(Attr));
+ Attr.att_atimechg = 1;
+ Attr.att_atime = sys::toTimeT(AccessTime);
+ Attr.att_mtimechg = 1;
+ Attr.att_mtime = sys::toTimeT(ModificationTime);
+ if (::__fchattr(FD, &Attr, sizeof(Attr)) != 0)
+ return std::error_code(errno, std::generic_category());
+ return std::error_code();
#else
#warning Missing futimes() and futimens()
return make_error_code(errc::function_not_supported);
@@ -1067,13 +1067,13 @@ file_t getStdoutHandle() { return 1; }
file_t getStderrHandle() { return 2; }
Expected<size_t> readNativeFile(file_t FD, MutableArrayRef<char> Buf) {
-#if defined(__APPLE__)
- size_t Size = std::min<size_t>(Buf.size(), INT32_MAX);
-#else
- size_t Size = Buf.size();
-#endif
+#if defined(__APPLE__)
+ size_t Size = std::min<size_t>(Buf.size(), INT32_MAX);
+#else
+ size_t Size = Buf.size();
+#endif
ssize_t NumRead =
- sys::RetryAfterSignal(-1, ::read, FD, Buf.data(), Size);
+ sys::RetryAfterSignal(-1, ::read, FD, Buf.data(), Size);
if (ssize_t(NumRead) == -1)
return errorCodeToError(std::error_code(errno, std::generic_category()));
return NumRead;
@@ -1081,69 +1081,69 @@ Expected<size_t> readNativeFile(file_t FD, MutableArrayRef<char> Buf) {
Expected<size_t> readNativeFileSlice(file_t FD, MutableArrayRef<char> Buf,
uint64_t Offset) {
-#if defined(__APPLE__)
- size_t Size = std::min<size_t>(Buf.size(), INT32_MAX);
-#else
- size_t Size = Buf.size();
-#endif
+#if defined(__APPLE__)
+ size_t Size = std::min<size_t>(Buf.size(), INT32_MAX);
+#else
+ size_t Size = Buf.size();
+#endif
#ifdef HAVE_PREAD
ssize_t NumRead =
- sys::RetryAfterSignal(-1, ::pread, FD, Buf.data(), Size, Offset);
+ sys::RetryAfterSignal(-1, ::pread, FD, Buf.data(), Size, Offset);
#else
if (lseek(FD, Offset, SEEK_SET) == -1)
return errorCodeToError(std::error_code(errno, std::generic_category()));
ssize_t NumRead =
- sys::RetryAfterSignal(-1, ::read, FD, Buf.data(), Size);
+ sys::RetryAfterSignal(-1, ::read, FD, Buf.data(), Size);
#endif
if (NumRead == -1)
return errorCodeToError(std::error_code(errno, std::generic_category()));
return NumRead;
}
-std::error_code tryLockFile(int FD, std::chrono::milliseconds Timeout) {
- auto Start = std::chrono::steady_clock::now();
- auto End = Start + Timeout;
- do {
- struct flock Lock;
- memset(&Lock, 0, sizeof(Lock));
- Lock.l_type = F_WRLCK;
- Lock.l_whence = SEEK_SET;
- Lock.l_start = 0;
- Lock.l_len = 0;
- if (::fcntl(FD, F_SETLK, &Lock) != -1)
- return std::error_code();
- int Error = errno;
- if (Error != EACCES && Error != EAGAIN)
- return std::error_code(Error, std::generic_category());
- usleep(1000);
- } while (std::chrono::steady_clock::now() < End);
- return make_error_code(errc::no_lock_available);
-}
-
-std::error_code lockFile(int FD) {
- struct flock Lock;
- memset(&Lock, 0, sizeof(Lock));
- Lock.l_type = F_WRLCK;
- Lock.l_whence = SEEK_SET;
- Lock.l_start = 0;
- Lock.l_len = 0;
- if (::fcntl(FD, F_SETLKW, &Lock) != -1)
- return std::error_code();
- int Error = errno;
- return std::error_code(Error, std::generic_category());
-}
-
-std::error_code unlockFile(int FD) {
- struct flock Lock;
- Lock.l_type = F_UNLCK;
- Lock.l_whence = SEEK_SET;
- Lock.l_start = 0;
- Lock.l_len = 0;
- if (::fcntl(FD, F_SETLK, &Lock) != -1)
- return std::error_code();
- return std::error_code(errno, std::generic_category());
-}
-
+std::error_code tryLockFile(int FD, std::chrono::milliseconds Timeout) {
+ auto Start = std::chrono::steady_clock::now();
+ auto End = Start + Timeout;
+ do {
+ struct flock Lock;
+ memset(&Lock, 0, sizeof(Lock));
+ Lock.l_type = F_WRLCK;
+ Lock.l_whence = SEEK_SET;
+ Lock.l_start = 0;
+ Lock.l_len = 0;
+ if (::fcntl(FD, F_SETLK, &Lock) != -1)
+ return std::error_code();
+ int Error = errno;
+ if (Error != EACCES && Error != EAGAIN)
+ return std::error_code(Error, std::generic_category());
+ usleep(1000);
+ } while (std::chrono::steady_clock::now() < End);
+ return make_error_code(errc::no_lock_available);
+}
+
+std::error_code lockFile(int FD) {
+ struct flock Lock;
+ memset(&Lock, 0, sizeof(Lock));
+ Lock.l_type = F_WRLCK;
+ Lock.l_whence = SEEK_SET;
+ Lock.l_start = 0;
+ Lock.l_len = 0;
+ if (::fcntl(FD, F_SETLKW, &Lock) != -1)
+ return std::error_code();
+ int Error = errno;
+ return std::error_code(Error, std::generic_category());
+}
+
+std::error_code unlockFile(int FD) {
+ struct flock Lock;
+ Lock.l_type = F_UNLCK;
+ Lock.l_whence = SEEK_SET;
+ Lock.l_start = 0;
+ Lock.l_len = 0;
+ if (::fcntl(FD, F_SETLK, &Lock) != -1)
+ return std::error_code();
+ return std::error_code(errno, std::generic_category());
+}
+
std::error_code closeFile(file_t &F) {
file_t TmpF = F;
F = kInvalidFile;