aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authoreeight <eeight@yandex-team.ru>2022-02-10 16:46:19 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:19 +0300
commitbd085aee9b4f7a0bee302ce687964ffb7098f986 (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system
parent475c0a46f28166e83fd263badc7546377cddcabe (diff)
downloadydb-bd085aee9b4f7a0bee302ce687964ffb7098f986.tar.gz
Restoring authorship annotation for <eeight@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system')
-rw-r--r--util/system/atexit.cpp6
-rw-r--r--util/system/atexit_ut.cpp2
-rw-r--r--util/system/backtrace.cpp36
-rw-r--r--util/system/backtrace.h8
-rw-r--r--util/system/condvar_ut.cpp4
-rw-r--r--util/system/context.cpp2
-rw-r--r--util/system/cpu_id.cpp8
-rw-r--r--util/system/cpu_id.h2
-rw-r--r--util/system/cpu_id_ut.cpp28
-rw-r--r--util/system/event_ut.cpp8
-rw-r--r--util/system/execpath.cpp4
-rw-r--r--util/system/fasttime.cpp6
-rw-r--r--util/system/filemap.cpp4
-rw-r--r--util/system/guard_ut.cpp2
-rw-r--r--util/system/hi_lo.cpp2
-rw-r--r--util/system/hi_lo.h256
-rw-r--r--util/system/hi_lo_ut.cpp38
-rw-r--r--util/system/mutex_ut.cpp4
-rw-r--r--util/system/rwlock_ut.cpp4
-rw-r--r--util/system/shellcommand.cpp2
-rw-r--r--util/system/thread.cpp6
-rw-r--r--util/system/thread.h12
-rw-r--r--util/system/thread_ut.cpp14
-rw-r--r--util/system/ut/ya.make2
24 files changed, 230 insertions, 230 deletions
diff --git a/util/system/atexit.cpp b/util/system/atexit.cpp
index 45bde32638..74fb10b6b1 100644
--- a/util/system/atexit.cpp
+++ b/util/system/atexit.cpp
@@ -124,13 +124,13 @@ void AtExit(TAtExitFunc func, void* ctx) {
}
static void TraditionalCloser(void* ctx) {
- reinterpret_cast<TTraditionalAtExitFunc>(ctx)();
+ reinterpret_cast<TTraditionalAtExitFunc>(ctx)();
}
void AtExit(TTraditionalAtExitFunc func) {
- AtExit(TraditionalCloser, reinterpret_cast<void*>(func));
+ AtExit(TraditionalCloser, reinterpret_cast<void*>(func));
}
void AtExit(TTraditionalAtExitFunc func, size_t priority) {
- AtExit(TraditionalCloser, reinterpret_cast<void*>(func), priority);
+ AtExit(TraditionalCloser, reinterpret_cast<void*>(func), priority);
}
diff --git a/util/system/atexit_ut.cpp b/util/system/atexit_ut.cpp
index fdf0413e0e..953f432811 100644
--- a/util/system/atexit_ut.cpp
+++ b/util/system/atexit_ut.cpp
@@ -28,7 +28,7 @@ struct TAtExitParams {
};
void MyAtExitFunc(void* ptr) {
- THolder<TAtExitParams> params{static_cast<TAtExitParams*>(ptr)};
+ THolder<TAtExitParams> params{static_cast<TAtExitParams*>(ptr)};
if (write(params->fd, params->str, strlen(params->str)) < 0) {
abort();
}
diff --git a/util/system/backtrace.cpp b/util/system/backtrace.cpp
index 1aa745c0cc..b77fe58fb1 100644
--- a/util/system/backtrace.cpp
+++ b/util/system/backtrace.cpp
@@ -243,7 +243,7 @@ void FormatBackTrace(IOutputStream* out, void* const* backtrace, size_t backtrac
}
}
-TFormatBackTraceFn FormatBackTraceFn = FormatBackTrace;
+TFormatBackTraceFn FormatBackTraceFn = FormatBackTrace;
TFormatBackTraceFn SetFormatBackTraceFn(TFormatBackTraceFn f) {
TFormatBackTraceFn prevFn = FormatBackTraceFn;
@@ -251,12 +251,12 @@ TFormatBackTraceFn SetFormatBackTraceFn(TFormatBackTraceFn f) {
return prevFn;
}
-void FormatBackTrace(IOutputStream* out) {
- void* array[300];
- const size_t s = BackTrace(array, Y_ARRAY_SIZE(array));
- FormatBackTraceFn(out, array, s);
-}
-
+void FormatBackTrace(IOutputStream* out) {
+ void* array[300];
+ const size_t s = BackTrace(array, Y_ARRAY_SIZE(array));
+ FormatBackTraceFn(out, array, s);
+}
+
TFormatBackTraceFn GetFormatBackTraceFn() {
return FormatBackTraceFn;
}
@@ -275,7 +275,7 @@ void TBackTrace::Capture() {
}
void TBackTrace::PrintTo(IOutputStream& out) const {
- FormatBackTraceFn(&out, Data, Size);
+ FormatBackTraceFn(&out, Data, Size);
}
TString TBackTrace::PrintToString() const {
@@ -283,7 +283,7 @@ TString TBackTrace::PrintToString() const {
PrintTo(ss);
return ss.Str();
}
-
+
size_t TBackTrace::size() const {
return Size;
}
@@ -296,12 +296,12 @@ TBackTrace::operator TBackTraceView() const {
return TBackTraceView(Data, Size);
}
-TBackTrace TBackTrace::FromCurrentException() {
-#ifdef _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_SIZE
- TBackTrace result;
- result.Size = __cxxabiv1::__cxa_collect_current_exception_backtrace(result.Data, CAPACITY);
- return result;
-#else
- return TBackTrace();
-#endif
-}
+TBackTrace TBackTrace::FromCurrentException() {
+#ifdef _YNDX_LIBUNWIND_EXCEPTION_BACKTRACE_SIZE
+ TBackTrace result;
+ result.Size = __cxxabiv1::__cxa_collect_current_exception_backtrace(result.Data, CAPACITY);
+ return result;
+#else
+ return TBackTrace();
+#endif
+}
diff --git a/util/system/backtrace.h b/util/system/backtrace.h
index 4271597f57..2fce7585c3 100644
--- a/util/system/backtrace.h
+++ b/util/system/backtrace.h
@@ -18,7 +18,7 @@ void FormatBackTrace(IOutputStream* out, void* const* backtrace, size_t backtrac
void FormatBackTrace(IOutputStream* out);
void PrintBackTrace();
-using TFormatBackTraceFn = void (*)(IOutputStream*, void* const* backtrace, size_t backtraceSize);
+using TFormatBackTraceFn = void (*)(IOutputStream*, void* const* backtrace, size_t backtraceSize);
TFormatBackTraceFn SetFormatBackTraceFn(TFormatBackTraceFn f);
TFormatBackTraceFn GetFormatBackTraceFn();
@@ -27,7 +27,7 @@ using TBackTraceView = TArrayRef<void* const>;
class TBackTrace {
private:
- static constexpr size_t CAPACITY = 300;
+ static constexpr size_t CAPACITY = 300;
void* Data[CAPACITY];
size_t Size;
@@ -39,6 +39,6 @@ public:
size_t size() const;
const void* const* data() const;
operator TBackTraceView() const;
-
- static TBackTrace FromCurrentException();
+
+ static TBackTrace FromCurrentException();
};
diff --git a/util/system/condvar_ut.cpp b/util/system/condvar_ut.cpp
index a0c5b86576..5130a18d32 100644
--- a/util/system/condvar_ut.cpp
+++ b/util/system/condvar_ut.cpp
@@ -6,7 +6,7 @@
#include <util/system/atomic.h>
#include <util/system/atomic_ops.h>
-#include <util/thread/pool.h>
+#include <util/thread/pool.h>
class TCondVarTest: public TTestBase {
UNIT_TEST_SUITE(TCondVarTest);
@@ -194,7 +194,7 @@ private:
}
#undef RUN_CYCLE
TSharedData Data_;
- TThreadPool Q_;
+ TThreadPool Q_;
};
UNIT_TEST_SUITE_REGISTRATION(TCondVarTest);
diff --git a/util/system/context.cpp b/util/system/context.cpp
index 1edc6a9b7a..ad99309088 100644
--- a/util/system/context.cpp
+++ b/util/system/context.cpp
@@ -189,7 +189,7 @@ TContMachineContext::TContMachineContext(const TContClosure& c)
__mysetjmp(Buf_);
- JmpBufProgrReg(Buf_) = reinterpret_cast<void*>(ContextTrampoLine);
+ JmpBufProgrReg(Buf_) = reinterpret_cast<void*>(ContextTrampoLine);
JmpBufStackReg(Buf_) = stack.StackPtr();
JmpBufFrameReg(Buf_) = nullptr;
}
diff --git a/util/system/cpu_id.cpp b/util/system/cpu_id.cpp
index 67eabee3be..598c71f4d9 100644
--- a/util/system/cpu_id.cpp
+++ b/util/system/cpu_id.cpp
@@ -162,10 +162,10 @@ bool NX86::HaveBMI1() noexcept {
return (TX86CpuInfo(0x7, 0).EBX >> 3) & 1u;
}
-bool NX86::HaveBMI2() noexcept {
- return (TX86CpuInfo(0x7, 0).EBX >> 8) & 1u;
-}
-
+bool NX86::HaveBMI2() noexcept {
+ return (TX86CpuInfo(0x7, 0).EBX >> 8) & 1u;
+}
+
bool NX86::HaveAVX512F() noexcept {
#if defined(_x86_)
// https://software.intel.com/en-us/articles/how-to-detect-knl-instruction-support
diff --git a/util/system/cpu_id.h b/util/system/cpu_id.h
index dc300cdbff..3c49e728a7 100644
--- a/util/system/cpu_id.h
+++ b/util/system/cpu_id.h
@@ -14,7 +14,7 @@
F(F16C) \
F(POPCNT) \
F(BMI1) \
- F(BMI2) \
+ F(BMI2) \
F(PCLMUL) \
F(AES) \
F(AVX) \
diff --git a/util/system/cpu_id_ut.cpp b/util/system/cpu_id_ut.cpp
index 9e0898ea89..68f1f8aac7 100644
--- a/util/system/cpu_id_ut.cpp
+++ b/util/system/cpu_id_ut.cpp
@@ -23,7 +23,7 @@ static void ExecuteAVXInstruction();
static void ExecuteAVX2Instruction();
static void ExecutePOPCNTInstruction();
static void ExecuteBMI1Instruction();
-static void ExecuteBMI2Instruction();
+static void ExecuteBMI2Instruction();
static void ExecutePCLMULInstruction();
static void ExecuteAESInstruction();
static void ExecuteAVXInstruction();
@@ -169,13 +169,13 @@ void ExecuteBMI1Instruction() {
: "eax");
}
-void ExecuteBMI2Instruction() {
- __asm__ __volatile__("pdep %%rax, %%rdi, %%rax\n"
- :
- :
- : "rax");
-}
-
+void ExecuteBMI2Instruction() {
+ __asm__ __volatile__("pdep %%rax, %%rdi, %%rax\n"
+ :
+ :
+ : "rax");
+}
+
void ExecutePCLMULInstruction() {
__asm__ __volatile__("pclmullqlqdq %%xmm0, %%xmm0\n"
:
@@ -291,9 +291,9 @@ void ExecutePOPCNTInstruction() {
void ExecuteBMI1Instruction() {
}
-void ExecuteBMI2Instruction() {
-}
-
+void ExecuteBMI2Instruction() {
+}
+
void ExecutePCLMULInstruction() {
}
@@ -388,9 +388,9 @@ void ExecutePOPCNTInstruction() {
void ExecuteBMI1Instruction() {
}
-void ExecuteBMI2Instruction() {
-}
-
+void ExecuteBMI2Instruction() {
+}
+
void ExecutePCLMULInstruction() {
}
diff --git a/util/system/event_ut.cpp b/util/system/event_ut.cpp
index 5e94a0890f..2506cb7a91 100644
--- a/util/system/event_ut.cpp
+++ b/util/system/event_ut.cpp
@@ -3,7 +3,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/thread/pool.h>
+#include <util/thread/pool.h>
namespace {
struct TSharedData {
@@ -85,7 +85,7 @@ namespace {
Y_UNIT_TEST_SUITE(EventTest) {
Y_UNIT_TEST(WaitAndSignalTest) {
TSharedData data;
- TThreadPool queue;
+ TThreadPool queue;
queue.Start(5);
for (size_t i = 0; i < 5; ++i) {
UNIT_ASSERT(queue.Add(new TThreadTask(data, i)));
@@ -99,7 +99,7 @@ Y_UNIT_TEST_SUITE(EventTest) {
// test for problem detected by thread-sanitizer (signal/wait race) SEARCH-2113
const size_t limit = 200;
TManualEvent event[limit];
- TThreadPool queue;
+ TThreadPool queue;
queue.Start(limit);
TVector<THolder<IObjectInQueue>> tasks;
for (size_t i = 0; i < limit; ++i) {
@@ -122,7 +122,7 @@ Y_UNIT_TEST_SUITE(EventTest) {
tasks.emplace_back(std::move(owner));
}
- TThreadPool queue;
+ TThreadPool queue;
queue.Start(4);
for (auto& task : tasks) {
UNIT_ASSERT(queue.Add(task.Get()));
diff --git a/util/system/execpath.cpp b/util/system/execpath.cpp
index 1b8d1ad4e4..33198af58b 100644
--- a/util/system/execpath.cpp
+++ b/util/system/execpath.cpp
@@ -159,13 +159,13 @@ static bool GetPersistentExecPathImpl(TString& to) {
#if defined(_solaris_)
to = TString("/proc/self/object/a.out");
return true;
-#elif defined(_linux_) || defined(_cygwin_)
+#elif defined(_linux_) || defined(_cygwin_)
to = TString("/proc/self/exe");
return true;
#elif defined(_freebsd_)
to = TString("/proc/curproc/file");
return true;
-#else // defined(_win_) || defined(_darwin_) or unknown
+#else // defined(_win_) || defined(_darwin_) or unknown
Y_UNUSED(to);
return false;
#endif
diff --git a/util/system/fasttime.cpp b/util/system/fasttime.cpp
index 8a93e76137..057a814f0a 100644
--- a/util/system/fasttime.cpp
+++ b/util/system/fasttime.cpp
@@ -34,16 +34,16 @@ namespace {
: Func(nullptr)
{
// not DEFAULT, cause library/cpp/gettimeofday
- Func = reinterpret_cast<TFunc>(dlsym(RTLD_NEXT, "gettimeofday"));
+ Func = reinterpret_cast<TFunc>(dlsym(RTLD_NEXT, "gettimeofday"));
#if defined(_musl_)
if (!Func) {
- Func = reinterpret_cast<TFunc>(NVdso::Function("__vdso_gettimeofday", "LINUX_2.6"));
+ Func = reinterpret_cast<TFunc>(NVdso::Function("__vdso_gettimeofday", "LINUX_2.6"));
}
#endif
if (!Func) {
- Func = reinterpret_cast<TFunc>(Libc()->Sym("gettimeofday"));
+ Func = reinterpret_cast<TFunc>(Libc()->Sym("gettimeofday"));
}
}
diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp
index 40bf8cfea1..7454a4cb94 100644
--- a/util/system/filemap.cpp
+++ b/util/system/filemap.cpp
@@ -1,7 +1,7 @@
#include "info.h"
#include "madvise.h"
#include "defaults.h"
-#include "hi_lo.h"
+#include "hi_lo.h"
#include <util/generic/buffer.h>
#include <util/generic/yexception.h>
@@ -239,7 +239,7 @@ public:
result.Ptr = MapViewOfFile(Mapping_,
(Mode_ & oAccessMask) == oRdOnly ? FILE_MAP_READ : (Mode_ & oAccessMask) == oCopyOnWr ? FILE_MAP_COPY
: FILE_MAP_WRITE,
- Hi32(base), Lo32(base), size);
+ Hi32(base), Lo32(base), size);
#else
#if defined(_unix_)
if (Mode_ & oNotGreedy) {
diff --git a/util/system/guard_ut.cpp b/util/system/guard_ut.cpp
index 14edb97f45..404ede99ab 100644
--- a/util/system/guard_ut.cpp
+++ b/util/system/guard_ut.cpp
@@ -3,7 +3,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/thread/pool.h>
+#include <util/thread/pool.h>
struct TTestGuard: public TTestBase {
UNIT_TEST_SUITE(TTestGuard);
diff --git a/util/system/hi_lo.cpp b/util/system/hi_lo.cpp
index 2950bc6096..97c3eba8be 100644
--- a/util/system/hi_lo.cpp
+++ b/util/system/hi_lo.cpp
@@ -1 +1 @@
-#include "hi_lo.h"
+#include "hi_lo.h"
diff --git a/util/system/hi_lo.h b/util/system/hi_lo.h
index 3dad401140..f86870534f 100644
--- a/util/system/hi_lo.h
+++ b/util/system/hi_lo.h
@@ -1,149 +1,149 @@
-#pragma once
-
-#include "unaligned_mem.h"
-
+#pragma once
+
+#include "unaligned_mem.h"
+
#include <utility>
-#ifndef _little_endian_
+#ifndef _little_endian_
#error "Not implemented"
-#endif
-
-namespace NHiLoPrivate {
- template <class TRepr>
- class TConstIntRef {
- public:
- explicit TConstIntRef(const char* ptr)
- : Ptr(ptr)
- {
- }
-
+#endif
+
+namespace NHiLoPrivate {
+ template <class TRepr>
+ class TConstIntRef {
+ public:
+ explicit TConstIntRef(const char* ptr)
+ : Ptr(ptr)
+ {
+ }
+
TRepr Get() const {
return ReadUnaligned<TRepr>(Ptr);
}
operator TRepr() const {
return Get();
}
-
+
const char* GetPtr() const {
return Ptr;
}
-
- protected:
- const char* Ptr;
- };
-
- template <class TRepr>
+
+ protected:
+ const char* Ptr;
+ };
+
+ template <class TRepr>
class TIntRef: public TConstIntRef<TRepr> {
- public:
- explicit TIntRef(char* ptr)
- : TConstIntRef<TRepr>(ptr)
- {
- }
-
- TIntRef& operator=(TRepr value) {
+ public:
+ explicit TIntRef(char* ptr)
+ : TConstIntRef<TRepr>(ptr)
+ {
+ }
+
+ TIntRef& operator=(TRepr value) {
WriteUnaligned<TRepr>(GetPtr(), value);
- return *this;
- }
-
+ return *this;
+ }
+
char* GetPtr() const {
return const_cast<char*>(this->Ptr);
}
- };
-
- template <class T>
- struct TReferenceType {
- using TType = T;
- };
-
- template <class T>
- struct TReferenceType<TConstIntRef<T>> {
- using TType = T;
- };
-
- template <class T>
- struct TReferenceType<TIntRef<T>> {
- using TType = T;
- };
-
- template <class TRepr>
- auto MakeIntRef(const char* ptr) {
- return TConstIntRef<TRepr>(ptr);
- }
-
- template <class TRepr>
- auto MakeIntRef(char* ptr) {
- return TIntRef<TRepr>(ptr);
- }
-
- template <class T>
- const char* CharPtrOf(const T& value) {
+ };
+
+ template <class T>
+ struct TReferenceType {
+ using TType = T;
+ };
+
+ template <class T>
+ struct TReferenceType<TConstIntRef<T>> {
+ using TType = T;
+ };
+
+ template <class T>
+ struct TReferenceType<TIntRef<T>> {
+ using TType = T;
+ };
+
+ template <class TRepr>
+ auto MakeIntRef(const char* ptr) {
+ return TConstIntRef<TRepr>(ptr);
+ }
+
+ template <class TRepr>
+ auto MakeIntRef(char* ptr) {
+ return TIntRef<TRepr>(ptr);
+ }
+
+ template <class T>
+ const char* CharPtrOf(const T& value) {
return reinterpret_cast<const char*>(&value);
- }
-
- template <class T>
- char* CharPtrOf(T& value) {
+ }
+
+ template <class T>
+ char* CharPtrOf(T& value) {
return reinterpret_cast<char*>(&value);
- }
-
- template <class T>
- const char* CharPtrOf(TConstIntRef<T> value) {
- return value.GetPtr();
- }
-
- template <class T>
- char* CharPtrOf(TIntRef<T> value) {
- return value.GetPtr();
- }
-
- template <bool IsLow, class TRepr, class T>
- auto MakeIntRef(T&& value) {
- using TRef = typename TReferenceType<typename std::decay<T>::type>::TType;
- static_assert(
+ }
+
+ template <class T>
+ const char* CharPtrOf(TConstIntRef<T> value) {
+ return value.GetPtr();
+ }
+
+ template <class T>
+ char* CharPtrOf(TIntRef<T> value) {
+ return value.GetPtr();
+ }
+
+ template <bool IsLow, class TRepr, class T>
+ auto MakeIntRef(T&& value) {
+ using TRef = typename TReferenceType<typename std::decay<T>::type>::TType;
+ static_assert(
std::is_scalar<TRef>::value,
"Hi* and Lo* functions can be applied only to scalar values");
- static_assert(sizeof(TRef) >= sizeof(TRepr), "Requested bit range is not within provided value");
- constexpr size_t offset = IsLow ? 0 : sizeof(TRef) - sizeof(TRepr);
-
- return MakeIntRef<TRepr>(CharPtrOf(std::forward<T>(value)) + offset);
- }
-}
-
-/**
- * Return manipulator object that allows to get and set lower or higher bits of the value.
- *
- * @param value Must be a scalar value of sufficient size or a manipulator object obtained by
- * calling any of the other Hi/Lo functions.
- *
- * @{
- */
-template <class T>
-auto Lo32(T&& value) {
- return NHiLoPrivate::MakeIntRef<true, ui32>(std::forward<T>(value));
-}
-
-template <class T>
-auto Hi32(T&& value) {
- return NHiLoPrivate::MakeIntRef<false, ui32>(std::forward<T>(value));
-}
-
-template <class T>
-auto Lo16(T&& value) {
- return NHiLoPrivate::MakeIntRef<true, ui16>(std::forward<T>(value));
-}
-
-template <class T>
-auto Hi16(T&& value) {
- return NHiLoPrivate::MakeIntRef<false, ui16>(std::forward<T>(value));
-}
-
-template <class T>
-auto Lo8(T&& value) {
- return NHiLoPrivate::MakeIntRef<true, ui8>(std::forward<T>(value));
-}
-
-template <class T>
-auto Hi8(T&& value) {
- return NHiLoPrivate::MakeIntRef<false, ui8>(std::forward<T>(value));
-}
-
-/** @} */
+ static_assert(sizeof(TRef) >= sizeof(TRepr), "Requested bit range is not within provided value");
+ constexpr size_t offset = IsLow ? 0 : sizeof(TRef) - sizeof(TRepr);
+
+ return MakeIntRef<TRepr>(CharPtrOf(std::forward<T>(value)) + offset);
+ }
+}
+
+/**
+ * Return manipulator object that allows to get and set lower or higher bits of the value.
+ *
+ * @param value Must be a scalar value of sufficient size or a manipulator object obtained by
+ * calling any of the other Hi/Lo functions.
+ *
+ * @{
+ */
+template <class T>
+auto Lo32(T&& value) {
+ return NHiLoPrivate::MakeIntRef<true, ui32>(std::forward<T>(value));
+}
+
+template <class T>
+auto Hi32(T&& value) {
+ return NHiLoPrivate::MakeIntRef<false, ui32>(std::forward<T>(value));
+}
+
+template <class T>
+auto Lo16(T&& value) {
+ return NHiLoPrivate::MakeIntRef<true, ui16>(std::forward<T>(value));
+}
+
+template <class T>
+auto Hi16(T&& value) {
+ return NHiLoPrivate::MakeIntRef<false, ui16>(std::forward<T>(value));
+}
+
+template <class T>
+auto Lo8(T&& value) {
+ return NHiLoPrivate::MakeIntRef<true, ui8>(std::forward<T>(value));
+}
+
+template <class T>
+auto Hi8(T&& value) {
+ return NHiLoPrivate::MakeIntRef<false, ui8>(std::forward<T>(value));
+}
+
+/** @} */
diff --git a/util/system/hi_lo_ut.cpp b/util/system/hi_lo_ut.cpp
index c19e7bbb02..850c12327d 100644
--- a/util/system/hi_lo_ut.cpp
+++ b/util/system/hi_lo_ut.cpp
@@ -1,62 +1,62 @@
-#include <util/system/hi_lo.h>
-
+#include <util/system/hi_lo.h>
+
#include <library/cpp/testing/unittest/registar.h>
-
-#include "defaults.h"
-
-Y_UNIT_TEST_SUITE(HiLo) {
+
+#include "defaults.h"
+
+Y_UNIT_TEST_SUITE(HiLo) {
Y_UNIT_TEST(HiLo32) {
ui64 x = 0;
Lo32(x) = 18;
UNIT_ASSERT_VALUES_EQUAL(x, 18);
-
+
Hi32(x) = 33;
UNIT_ASSERT_VALUES_EQUAL(x, 141733920786);
-
+
const ui64 y = 0x33c06196e94c03ab;
UNIT_ASSERT_VALUES_EQUAL(Lo32(y).Get(), 0xe94c03ab);
UNIT_ASSERT_VALUES_EQUAL(Hi32(y).Get(), 0x33c06196);
}
-
+
Y_UNIT_TEST(HiLo16) {
ui32 x = 0;
Lo16(x) = 18;
UNIT_ASSERT_VALUES_EQUAL(x, 18);
-
+
Hi16(x) = 33;
UNIT_ASSERT_VALUES_EQUAL(x, 2162706);
-
+
const ui32 y = 0xe94c03ab;
UNIT_ASSERT_VALUES_EQUAL(Lo16(y).Get(), 0x03ab);
UNIT_ASSERT_VALUES_EQUAL(Hi16(y).Get(), 0xe94c);
}
-
+
Y_UNIT_TEST(HiLo8) {
ui16 x = 0;
Lo8(x) = 18;
UNIT_ASSERT_VALUES_EQUAL(x, 18);
-
+
Hi8(x) = 33;
UNIT_ASSERT_VALUES_EQUAL(x, 8466);
-
+
const ui16 y = 0x03ab;
UNIT_ASSERT_VALUES_EQUAL(Lo8(y).Get(), 0xab);
UNIT_ASSERT_VALUES_EQUAL(Hi8(y).Get(), 0x03);
}
-
+
Y_UNIT_TEST(Combined) {
ui32 x = 0;
Lo8(Lo16(x)) = 18;
UNIT_ASSERT_VALUES_EQUAL(x, 18);
-
+
Hi8(Lo16(x)) = 33;
UNIT_ASSERT_VALUES_EQUAL(x, 8466);
-
+
const ui32 y = 0xe94c03ab;
UNIT_ASSERT_VALUES_EQUAL(Lo8(Lo16(y)).Get(), 0xab);
UNIT_ASSERT_VALUES_EQUAL(Hi8(Lo16(y)).Get(), 0x03);
}
-
+
Y_UNIT_TEST(NarrowFromWide) {
const ui64 x = 0x1122334455667788ull;
UNIT_ASSERT_VALUES_EQUAL(Lo8(x).Get(), 0x88);
@@ -66,4 +66,4 @@ Y_UNIT_TEST_SUITE(HiLo) {
UNIT_ASSERT_VALUES_EQUAL(Lo32(x).Get(), 0x55667788);
UNIT_ASSERT_VALUES_EQUAL(Hi32(x).Get(), 0x11223344);
}
-}
+}
diff --git a/util/system/mutex_ut.cpp b/util/system/mutex_ut.cpp
index 1dba4eb0bd..c8d7caafa1 100644
--- a/util/system/mutex_ut.cpp
+++ b/util/system/mutex_ut.cpp
@@ -3,7 +3,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/thread/pool.h>
+#include <util/thread/pool.h>
#include <util/random/random.h>
class TMutexTest: public TTestBase {
@@ -123,7 +123,7 @@ private:
private:
TSharedData Data_;
- TThreadPool Q_;
+ TThreadPool Q_;
};
UNIT_TEST_SUITE_REGISTRATION(TMutexTest)
diff --git a/util/system/rwlock_ut.cpp b/util/system/rwlock_ut.cpp
index 235d28a363..2b384c05b3 100644
--- a/util/system/rwlock_ut.cpp
+++ b/util/system/rwlock_ut.cpp
@@ -3,7 +3,7 @@
#include <library/cpp/testing/unittest/registar.h>
-#include <util/thread/pool.h>
+#include <util/thread/pool.h>
#include <util/random/random.h>
class TRWMutexTest: public TTestBase {
@@ -118,7 +118,7 @@ private:
#undef RUN_CYCLE
private:
TSharedData Data_;
- TThreadPool Q_;
+ TThreadPool Q_;
};
UNIT_TEST_SUITE_REGISTRATION(TRWMutexTest)
diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp
index 0ba5b81ac0..b1989b5c8c 100644
--- a/util/system/shellcommand.cpp
+++ b/util/system/shellcommand.cpp
@@ -13,7 +13,7 @@
#include <util/network/socket.h>
#include <util/stream/pipe.h>
#include <util/stream/str.h>
-#include <util/string/cast.h>
+#include <util/string/cast.h>
#include <util/system/info.h>
#include <errno.h>
diff --git a/util/system/thread.cpp b/util/system/thread.cpp
index d471cfa0f2..6236746c2d 100644
--- a/util/system/thread.cpp
+++ b/util/system/thread.cpp
@@ -44,7 +44,7 @@ namespace {
inline void SetThrName(const TParams& p) {
try {
if (p.Name) {
- TThread::SetCurrentThreadName(p.Name.data());
+ TThread::SetCurrentThreadName(p.Name.data());
}
} catch (...) {
// ¯\_(ツ)_/¯
@@ -445,7 +445,7 @@ namespace {
}
#endif // _win_
-void TThread::SetCurrentThreadName(const char* name) {
+void TThread::SetCurrentThreadName(const char* name) {
(void)name;
#if defined(_freebsd_)
@@ -469,7 +469,7 @@ void TThread::SetCurrentThreadName(const char* name) {
#endif // OS
}
-TString TThread::CurrentThreadName() {
+TString TThread::CurrentThreadName() {
#if defined(_freebsd_)
// TODO: check pthread_get_name_np API availability
#elif defined(_linux_)
diff --git a/util/system/thread.h b/util/system/thread.h
index 2a666fb9c2..a6e8abdb5b 100644
--- a/util/system/thread.h
+++ b/util/system/thread.h
@@ -1,8 +1,8 @@
#pragma once
/// This code should not be used directly unless you really understand what you do.
-/// If you need threads, use thread pool functionality in <util/thread/factory.h>
-/// @see SystemThreadFactory()
+/// If you need threads, use thread pool functionality in <util/thread/factory.h>
+/// @see SystemThreadFactory()
#include <util/generic/ptr.h>
#include <util/generic/string.h>
@@ -26,7 +26,7 @@ public:
void* Data;
size_t StackSize;
void* StackPointer;
- // See comments for `SetCurrentThreadName`
+ // See comments for `SetCurrentThreadName`
TString Name = GetProgramName();
inline TParams()
@@ -114,12 +114,12 @@ public:
//
// NOTE: On Linux thread name is limited to 15 symbols which is probably the smallest one among
// all platforms. If you provide a name longer than 15 symbols it will be cut. So if you expect
- // `CurrentThreadName` to return the same name as `name` make sure it's not longer than 15
+ // `CurrentThreadName` to return the same name as `name` make sure it's not longer than 15
// symbols.
- static void SetCurrentThreadName(const char* name);
+ static void SetCurrentThreadName(const char* name);
// NOTE: Will return empty string where CanGetCurrentThreadName() returns false.
- static TString CurrentThreadName();
+ static TString CurrentThreadName();
// NOTE: Depends on a platform version.
// Will return true for Darwin, Linux or fresh Windows 10.
diff --git a/util/system/thread_ut.cpp b/util/system/thread_ut.cpp
index a2a4aab4cb..d820898fd5 100644
--- a/util/system/thread_ut.cpp
+++ b/util/system/thread_ut.cpp
@@ -47,7 +47,7 @@ Y_UNIT_TEST_SUITE(TSysThreadTest) {
}
void* ThreadProc(void*) {
- TThread::SetCurrentThreadName("CurrentThreadSetNameTest");
+ TThread::SetCurrentThreadName("CurrentThreadSetNameTest");
return nullptr;
}
@@ -56,16 +56,16 @@ Y_UNIT_TEST_SUITE(TSysThreadTest) {
}
void* ThreadProc3(void*) {
- const auto name = TThread::CurrentThreadName();
+ const auto name = TThread::CurrentThreadName();
Y_FAKE_READ(name);
return nullptr;
}
void* ThreadProc4(void*) {
const TString setName = "ThreadName";
- TThread::SetCurrentThreadName(setName.data());
+ TThread::SetCurrentThreadName(setName.data());
- const auto getName = TThread::CurrentThreadName();
+ const auto getName = TThread::CurrentThreadName();
if (TThread::CanGetCurrentThreadName()) {
UNIT_ASSERT_VALUES_EQUAL(setName, getName);
} else {
@@ -75,7 +75,7 @@ Y_UNIT_TEST_SUITE(TSysThreadTest) {
}
void* ThreadProcChild(void*) {
- const auto name = TThread::CurrentThreadName();
+ const auto name = TThread::CurrentThreadName();
const auto defaultName = GetProgramName();
(void)name;
@@ -89,14 +89,14 @@ Y_UNIT_TEST_SUITE(TSysThreadTest) {
void* ThreadProcParent(void*) {
const TString setName = "Parent";
- TThread::SetCurrentThreadName(setName.data());
+ TThread::SetCurrentThreadName(setName.data());
TThread thread(&ThreadProcChild, nullptr);
thread.Start();
thread.Join();
- const auto getName = TThread::CurrentThreadName();
+ const auto getName = TThread::CurrentThreadName();
if (TThread::CanGetCurrentThreadName()) {
UNIT_ASSERT_VALUES_EQUAL(setName, getName);
} else {
diff --git a/util/system/ut/ya.make b/util/system/ut/ya.make
index 99d468ef35..127e7c261e 100644
--- a/util/system/ut/ya.make
+++ b/util/system/ut/ya.make
@@ -48,7 +48,7 @@ SRCS(
system/fstat_ut.cpp
system/getpid_ut.cpp
system/guard_ut.cpp
- system/hi_lo_ut.cpp
+ system/hi_lo_ut.cpp
system/hostname_ut.cpp
system/info_ut.cpp
system/interrupt_signals_ut.cpp