diff options
author | ivanmorozov <ivanmorozov@yandex-team.ru> | 2022-02-10 16:47:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:33 +0300 |
commit | cba5d9a444e2cfe105f55ccda66cd21d50440017 (patch) | |
tree | 79983e83d1a91aebeb1999338090eec69e24cc33 /util/system | |
parent | eb540cc7a103419462d0cc870ca403966e2194c6 (diff) | |
download | ydb-cba5d9a444e2cfe105f55ccda66cd21d50440017.tar.gz |
Restoring authorship annotation for <ivanmorozov@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r-- | util/system/cpu_id.cpp | 4 | ||||
-rw-r--r-- | util/system/env.cpp | 4 | ||||
-rw-r--r-- | util/system/error.cpp | 20 | ||||
-rw-r--r-- | util/system/file.cpp | 2 | ||||
-rw-r--r-- | util/system/fs.cpp | 6 | ||||
-rw-r--r-- | util/system/fs_ut.cpp | 50 | ||||
-rw-r--r-- | util/system/rwlock.h | 18 |
7 files changed, 52 insertions, 52 deletions
diff --git a/util/system/cpu_id.cpp b/util/system/cpu_id.cpp index 598c71f4d91..b88b2c12c88 100644 --- a/util/system/cpu_id.cpp +++ b/util/system/cpu_id.cpp @@ -9,8 +9,8 @@ #include <immintrin.h> #elif defined(_x86_) #include <cpuid.h> -#endif - +#endif + #include <string.h> #if defined(_x86_) && !defined(_win_) diff --git a/util/system/env.cpp b/util/system/env.cpp index ead9b566a5f..33b9288e2de 100644 --- a/util/system/env.cpp +++ b/util/system/env.cpp @@ -3,13 +3,13 @@ #include <util/generic/string.h> #include <util/generic/yexception.h> -#ifdef _win_ +#ifdef _win_ #include <util/generic/vector.h> #include "winint.h" #else #include <cerrno> #include <cstdlib> -#endif +#endif /** * On Windows there may be many copies of enviroment variables, there at least two known, one is diff --git a/util/system/error.cpp b/util/system/error.cpp index f778ec42cbe..f02b3e800f8 100644 --- a/util/system/error.cpp +++ b/util/system/error.cpp @@ -26,19 +26,19 @@ void ClearLastSystemError() { int LastSystemError() { #if defined(_win_) - int ret = GetLastError(); + int ret = GetLastError(); - if (ret) + if (ret) return ret; - ret = WSAGetLastError(); - - if (ret) - return ret; - // when descriptors number are over maximum, errno set in this variable - ret = *(_errno()); - return ret; - + ret = WSAGetLastError(); + + if (ret) + return ret; + // when descriptors number are over maximum, errno set in this variable + ret = *(_errno()); + return ret; + #else return errno; #endif diff --git a/util/system/file.cpp b/util/system/file.cpp index 4a261d020cb..42adcb8b2f2 100644 --- a/util/system/file.cpp +++ b/util/system/file.cpp @@ -1272,7 +1272,7 @@ TFile Duplicate(int fd) { FHANDLE dupHandle; if (!::DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), &dupHandle, 0, TRUE, DUPLICATE_SAME_ACCESS)) { - ythrow TFileError() << "can not duplicate file descriptor " << LastSystemError() << Endl; + ythrow TFileError() << "can not duplicate file descriptor " << LastSystemError() << Endl; } return TFile(dupHandle); diff --git a/util/system/fs.cpp b/util/system/fs.cpp index d2611a8ccc4..33b23d09dec 100644 --- a/util/system/fs.cpp +++ b/util/system/fs.cpp @@ -95,9 +95,9 @@ bool NFs::Rename(const TString& oldPath, const TString& newPath) { void NFs::HardLinkOrCopy(const TString& existingPath, const TString& newPath) { if (!NFs::HardLink(existingPath, newPath)) { Copy(existingPath, newPath); - } -} - + } +} + bool NFs::HardLink(const TString& existingPath, const TString& newPath) { #if defined(_win_) return NFsPrivate::WinHardLink(existingPath, newPath); diff --git a/util/system/fs_ut.cpp b/util/system/fs_ut.cpp index de071ebf55b..b6e12857e4f 100644 --- a/util/system/fs_ut.cpp +++ b/util/system/fs_ut.cpp @@ -15,7 +15,7 @@ class TFsTest: public TTestBase { UNIT_TEST(TestCreateRemove); UNIT_TEST(TestRename); UNIT_TEST(TestSymlink); - UNIT_TEST(TestHardlink); + UNIT_TEST(TestHardlink); UNIT_TEST(TestCwdOpts); UNIT_TEST(TestEnsureExists); UNIT_TEST_SUITE_END(); @@ -24,7 +24,7 @@ public: void TestCreateRemove(); void TestRename(); void TestSymlink(); - void TestHardlink(); + void TestHardlink(); void TestCwdOpts(); void TestEnsureExists(); }; @@ -97,10 +97,10 @@ void TFsTest::TestCreateRemove() { } void RunRenameTest(TFsPath src, TFsPath dst) { - // if previous running was failed + // if previous running was failed TFsPath dir1 = "dir"; TFsPath dir2 = "dst_dir"; - + NFs::Remove(src); NFs::Remove(dst); @@ -109,22 +109,22 @@ void RunRenameTest(TFsPath src, TFsPath dst) { NFs::Remove(dir2 / src); NFs::Remove(dir2); - { + { TFile file(src, CreateNew | WrOnly); - file.Write("123", 3); - } - + file.Write("123", 3); + } + UNIT_ASSERT(NFs::Rename(src, dst)); UNIT_ASSERT(NFs::Exists(dst)); UNIT_ASSERT(!NFs::Exists(src)); - { + { TFile file(dst, OpenExisting); - UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 3); - } + UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 3); + } NFs::MakeDirectory(dir1); - { + { TFile file(dir1 / src, CreateNew | WrOnly); file.Write("123", 3); } @@ -166,26 +166,26 @@ static void RunHardlinkTest(const TFsPath& src, const TFsPath& dst) { } { TFile file(src, OpenExisting | WrOnly); - file.Write("1234", 4); - } - { + file.Write("1234", 4); + } + { TFile file(dst, OpenExisting | RdOnly); - UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 4); - } - { + UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 4); + } + { TFile file(dst, OpenExisting | WrOnly); - file.Write("12345", 5); - } + file.Write("12345", 5); + } - { + { TFile file(src, OpenExisting | RdOnly); - UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 5); - } + UNIT_ASSERT_VALUES_EQUAL(file.GetLength(), 5); + } UNIT_ASSERT(NFs::Remove(dst)); UNIT_ASSERT(NFs::Remove(src)); -} - +} + void TFsTest::TestHardlink() { RunHardlinkTest("tempfile", "hardlinkfile"); RunHardlinkTest("tempfile_абвг", "hardlinkfile_абвг"); //utf-8 names diff --git a/util/system/rwlock.h b/util/system/rwlock.h index 0bb9b3fe1c8..e9d40629927 100644 --- a/util/system/rwlock.h +++ b/util/system/rwlock.h @@ -55,24 +55,24 @@ struct TWriteGuardOps { }; template <class T> -struct TTryWriteGuardOps: public TWriteGuardOps<T> { +struct TTryWriteGuardOps: public TWriteGuardOps<T> { static inline bool TryAcquire(T* t) noexcept { - return t->TryAcquireWrite(); - } -}; - -template <class T> + return t->TryAcquireWrite(); + } +}; + +template <class T> using TReadGuardBase = TGuard<T, TReadGuardOps<T>>; template <class T> using TTryReadGuardBase = TTryGuard<T, TTryReadGuardOps<T>>; template <class T> using TWriteGuardBase = TGuard<T, TWriteGuardOps<T>>; -template <class T> -using TTryWriteGuardBase = TTryGuard<T, TTryWriteGuardOps<T>>; +template <class T> +using TTryWriteGuardBase = TTryGuard<T, TTryWriteGuardOps<T>>; using TReadGuard = TReadGuardBase<TRWMutex>; using TTryReadGuard = TTryReadGuardBase<TRWMutex>; using TWriteGuard = TWriteGuardBase<TRWMutex>; -using TTryWriteGuard = TTryWriteGuardBase<TRWMutex>; +using TTryWriteGuard = TTryWriteGuardBase<TRWMutex>; |