diff options
author | vvvv <vvvv@yandex-team.ru> | 2022-02-10 16:46:34 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:34 +0300 |
commit | ad94e93a059747f4fc3d7add88d1a83daf40b733 (patch) | |
tree | 731d57e580bd143e1136e7747f13b26e6bac95d0 /util/system | |
parent | 298c6da79f1d8f35089a67f463f0b541bec36d9b (diff) | |
download | ydb-ad94e93a059747f4fc3d7add88d1a83daf40b733.tar.gz |
Restoring authorship annotation for <vvvv@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r-- | util/system/backtrace.cpp | 74 | ||||
-rw-r--r-- | util/system/backtrace.h | 2 | ||||
-rw-r--r-- | util/system/compiler.h | 12 | ||||
-rw-r--r-- | util/system/shellcommand.cpp | 14 | ||||
-rw-r--r-- | util/system/spinlock.h | 4 |
5 files changed, 53 insertions, 53 deletions
diff --git a/util/system/backtrace.cpp b/util/system/backtrace.cpp index b77fe58fb1..220a89e8b4 100644 --- a/util/system/backtrace.cpp +++ b/util/system/backtrace.cpp @@ -8,15 +8,15 @@ #include <util/generic/array_ref.h> #include <util/generic/string.h> -#ifdef _win_ +#ifdef _win_ #include "mutex.h" - + #ifndef OPTIONAL #define OPTIONAL #endif #include <dbghelp.h> -#endif - +#endif + #if defined(_bionic_) //TODO #else @@ -48,7 +48,7 @@ extern "C" __stdcall unsigned short CaptureStackBackTrace(unsigned long FramesTo #define HAVE_BACKTRACE #endif #endif - + #if defined(USE_GLIBC_BACKTRACE) #include <execinfo.h> @@ -104,12 +104,12 @@ size_t BackTrace(void** p, size_t len) { } #endif -#if defined(USE_WIN_BACKTRACE) -size_t BackTrace(void** p, size_t len) { - return CaptureStackBackTrace(0, len, p, nullptr); -} -#endif - +#if defined(USE_WIN_BACKTRACE) +size_t BackTrace(void** p, size_t len) { + return CaptureStackBackTrace(0, len, p, nullptr); +} +#endif + #if !defined(HAVE_BACKTRACE) size_t BackTrace(void**, size_t) { return 0; @@ -148,15 +148,15 @@ TResolvedSymbol ResolveSymbol(void* sym, char* buf, size_t len) { return ret; } -#elif defined(_win_) +#elif defined(_win_) #include <util/generic/singleton.h> -namespace { +namespace { struct TWinSymbolResolverImpl { typedef BOOL(WINAPI* TSymInitializeFunc)(HANDLE, PCSTR, BOOL); typedef BOOL(WINAPI* TSymCleanupFunc)(HANDLE); typedef BOOL(WINAPI* TSymFromAddrFunc)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO); - + TWinSymbolResolverImpl() : InitOk(FALSE) { @@ -164,52 +164,52 @@ namespace { if (!Library) { return; } - + SymInitializeFunc = (TSymInitializeFunc)GetProcAddress(Library, "SymInitialize"); SymCleanupFunc = (TSymCleanupFunc)GetProcAddress(Library, "SymCleanup"); SymFromAddrFunc = (TSymFromAddrFunc)GetProcAddress(Library, "SymFromAddr"); if (SymInitializeFunc && SymCleanupFunc && SymFromAddrFunc) { InitOk = SymInitializeFunc(GetCurrentProcess(), nullptr, TRUE); } - } - + } + ~TWinSymbolResolverImpl() { if (InitOk) { SymCleanupFunc(GetCurrentProcess()); } - + if (Library) { FreeLibrary(Library); } - } - + } + TResolvedSymbol Resolve(void* sym, char* buf, size_t len) { TGuard<TMutex> guard(Mutex); - + TResolvedSymbol ret = { "??", sym}; - + if (!InitOk || (len <= 1 + sizeof(SYMBOL_INFO))) { return ret; } - + SYMBOL_INFO* symbol = (SYMBOL_INFO*)buf; Zero(*symbol); - + symbol->MaxNameLen = len - sizeof(SYMBOL_INFO) - 1; symbol->SizeOfStruct = sizeof(SYMBOL_INFO); - + DWORD64 displacement = 0; BOOL res = SymFromAddrFunc(GetCurrentProcess(), (DWORD64)sym, &displacement, symbol); if (res) { ret.NearestSymbol = (void*)symbol->Address; ret.Name = symbol->Name; } - + return ret; - } - + } + TMutex Mutex; HMODULE Library; TSymInitializeFunc SymInitializeFunc; @@ -217,11 +217,11 @@ namespace { TSymFromAddrFunc SymFromAddrFunc; BOOL InitOk; }; -} - -TResolvedSymbol ResolveSymbol(void* sym, char* buf, size_t len) { - return Singleton<TWinSymbolResolverImpl>()->Resolve(sym, buf, len); -} +} + +TResolvedSymbol ResolveSymbol(void* sym, char* buf, size_t len) { + return Singleton<TWinSymbolResolverImpl>()->Resolve(sym, buf, len); +} #else TResolvedSymbol ResolveSymbol(void* sym, char*, size_t) { TResolvedSymbol ret = { @@ -257,10 +257,10 @@ void FormatBackTrace(IOutputStream* out) { FormatBackTraceFn(out, array, s); } -TFormatBackTraceFn GetFormatBackTraceFn() { - return FormatBackTraceFn; -} - +TFormatBackTraceFn GetFormatBackTraceFn() { + return FormatBackTraceFn; +} + void PrintBackTrace() { FormatBackTrace(&Cerr); } diff --git a/util/system/backtrace.h b/util/system/backtrace.h index 2fce7585c3..4450644301 100644 --- a/util/system/backtrace.h +++ b/util/system/backtrace.h @@ -21,7 +21,7 @@ void PrintBackTrace(); using TFormatBackTraceFn = void (*)(IOutputStream*, void* const* backtrace, size_t backtraceSize); TFormatBackTraceFn SetFormatBackTraceFn(TFormatBackTraceFn f); -TFormatBackTraceFn GetFormatBackTraceFn(); +TFormatBackTraceFn GetFormatBackTraceFn(); using TBackTraceView = TArrayRef<void* const>; diff --git a/util/system/compiler.h b/util/system/compiler.h index b373edcc46..957cbee5bc 100644 --- a/util/system/compiler.h +++ b/util/system/compiler.h @@ -179,14 +179,14 @@ #define Y_HIDDEN #endif -#if defined(__GNUC__) +#if defined(__GNUC__) #define Y_PUBLIC __attribute__((visibility("default"))) -#endif - -#if !defined(Y_PUBLIC) +#endif + +#if !defined(Y_PUBLIC) #define Y_PUBLIC -#endif - +#endif + #if !defined(Y_UNUSED) && !defined(__cplusplus) #define Y_UNUSED(var) (void)(var) #endif diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp index b1989b5c8c..11eff0d3af 100644 --- a/util/system/shellcommand.cpp +++ b/util/system/shellcommand.cpp @@ -322,12 +322,12 @@ public: delete WatchThread; } - -#if defined(_win_) - if (Pid) { - CloseHandle(Pid); - } -#endif + +#if defined(_win_) + if (Pid) { + CloseHandle(Pid); + } +#endif } inline void AppendArgument(const TStringBuf argument) { @@ -622,7 +622,7 @@ void TShellCommand::TImpl::StartProcess(TShellCommand::TImpl::TPipes& pipes) { out << "Process was not created: " << LastSystemErrorText() << " command text was: '" << GetAString(cmdcopy.Data()) << "'"; } Pid = process_info.hProcess; - CloseHandle(process_info.hThread); + CloseHandle(process_info.hThread); DBG(Cerr << "created process id " << Pid << " in dir: " << cwd << ", cmd: " << cmdcopy.Data() << Endl); } #endif diff --git a/util/system/spinlock.h b/util/system/spinlock.h index af2630890a..08cc7719d8 100644 --- a/util/system/spinlock.h +++ b/util/system/spinlock.h @@ -5,8 +5,8 @@ class TSpinLockBase { protected: - inline TSpinLockBase() noexcept { - AtomicSet(Val_, 0); + inline TSpinLockBase() noexcept { + AtomicSet(Val_, 0); } public: |