diff options
author | iseg <iseg@yandex-team.ru> | 2022-02-10 16:49:39 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:39 +0300 |
commit | f828a15ab90e9ca8e848f83caf95c95f06be46e7 (patch) | |
tree | de25241f7ec727b05ff1e5b9e1336f567f788a44 /util/system | |
parent | 8124e2bb214b063687e0d77c900150c727e16782 (diff) | |
download | ydb-f828a15ab90e9ca8e848f83caf95c95f06be46e7.tar.gz |
Restoring authorship annotation for <iseg@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r-- | util/system/compat.cpp | 2 | ||||
-rw-r--r-- | util/system/compat.h | 8 | ||||
-rw-r--r-- | util/system/defaults.h | 28 | ||||
-rw-r--r-- | util/system/filemap.cpp | 12 | ||||
-rw-r--r-- | util/system/filemap.h | 12 | ||||
-rw-r--r-- | util/system/maxlen.h | 2 | ||||
-rw-r--r-- | util/system/mutex.cpp | 30 | ||||
-rw-r--r-- | util/system/mutex.h | 8 | ||||
-rw-r--r-- | util/system/sys_alloc.h | 2 | ||||
-rw-r--r-- | util/system/tls.h | 14 | ||||
-rw-r--r-- | util/system/yassert.h | 4 |
11 files changed, 61 insertions, 61 deletions
diff --git a/util/system/compat.cpp b/util/system/compat.cpp index 18fbfa296a..5fe6332b82 100644 --- a/util/system/compat.cpp +++ b/util/system/compat.cpp @@ -8,7 +8,7 @@ #include <cstring> #include <cstdarg> #include <cstdlib> - + #include <util/generic/string.h> #ifdef _win_ diff --git a/util/system/compat.h b/util/system/compat.h index c53dbcca17..679f51084a 100644 --- a/util/system/compat.h +++ b/util/system/compat.h @@ -1,11 +1,11 @@ #pragma once - + #include "defaults.h" #include <cstdarg> #include <csignal> - + #if defined(_unix_) #include <unistd.h> #endif @@ -14,10 +14,10 @@ #include <process.h> #endif -extern "C" { +extern "C" { #if defined(_win_) using pid_t = int; - + inline unsigned int alarm(unsigned int /*seconds*/) { return 0; // no alarm is currently set :) } diff --git a/util/system/defaults.h b/util/system/defaults.h index dcd7abea38..300448e7d7 100644 --- a/util/system/defaults.h +++ b/util/system/defaults.h @@ -14,10 +14,10 @@ #include <new> #endif -// low and high parts of integers +// low and high parts of integers #if !defined(_win_) #include <sys/param.h> -#endif +#endif #if defined(BSD) || defined(_android_) @@ -42,20 +42,20 @@ #else #define _little_endian_ #endif - -// alignment + +// alignment #if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_QUADS) #define _must_align8_ -#endif - +#endif + #if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_LONGS) #define _must_align4_ -#endif - +#endif + #if (defined(_sun_) && !defined(__i386__)) || defined(_hpux_) || defined(__alpha__) || defined(__ia64__) || defined(WHATEVER_THAT_NEEDS_ALIGNING_SHORTS) #define _must_align2_ -#endif - +#endif + #if defined(__GNUC__) #define alias_hack __attribute__((__may_alias__)) #endif @@ -66,13 +66,13 @@ #include "types.h" -#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) #define PRAGMA(x) _Pragma(#x) #define RCSID(idstr) PRAGMA(comment(exestr, idstr)) -#else +#else #define RCSID(idstr) static const char rcsid[] = idstr -#endif - +#endif + #include "compiler.h" #ifdef _win_ diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp index 7454a4cb94..fc125cc9bf 100644 --- a/util/system/filemap.cpp +++ b/util/system/filemap.cpp @@ -6,7 +6,7 @@ #include <util/generic/buffer.h> #include <util/generic/yexception.h> #include <util/generic/singleton.h> - + #if defined(_win_) #include "winint.h" #elif defined(_unix_) @@ -28,8 +28,8 @@ #endif #else #error todo -#endif - +#endif + #include <util/generic/utility.h> #include <util/system/sanitizers.h> #include "filemap.h" @@ -254,7 +254,7 @@ public: result.Ptr = PtrStart_ ? static_cast<caddr_t>(PtrStart_) + base : nullptr; } #endif -#endif +#endif if (result.Ptr != nullptr || size == 0) { // allow map of size 0 result.Size = size; } else { @@ -284,8 +284,8 @@ public: } #endif } -#endif - +#endif + void SetSequential() { #if defined(_unix_) if (!(Mode_ & oNotGreedy) && Length_) { diff --git a/util/system/filemap.h b/util/system/filemap.h index 11be64bff4..bbcabc4ec0 100644 --- a/util/system/filemap.h +++ b/util/system/filemap.h @@ -1,5 +1,5 @@ #pragma once - + #include "file.h" #include "align.h" #include "yassert.h" @@ -47,7 +47,7 @@ struct TMemoryMapCommon { Reset(); } }; - + enum EOpenModeFlag { oRdOnly = 1, oRdWr = 2, @@ -105,7 +105,7 @@ private: class TImpl; TSimpleIntrusivePtr<TImpl> Impl_; }; - + class TFileMap: public TMemoryMapCommon { public: TFileMap(const TMemoryMap& map) noexcept; @@ -141,7 +141,7 @@ public: inline i64 Length() const noexcept { return Map_.Length(); } - + inline bool IsOpen() const noexcept { return Map_.IsOpen(); } @@ -182,7 +182,7 @@ private: TMemoryMap Map_; TMapResult Region_; }; - + template <class T> class TFileMappedArray { private: @@ -325,7 +325,7 @@ private: bool Shared_ = false; #ifdef _win_ void* Mapping_ = nullptr; -#endif +#endif }; template <class T> diff --git a/util/system/maxlen.h b/util/system/maxlen.h index e1ff7f5008..a522914401 100644 --- a/util/system/maxlen.h +++ b/util/system/maxlen.h @@ -1,5 +1,5 @@ #pragma once - + #include <cstdlib> // http://support.microsoft.com/kb/208427 diff --git a/util/system/mutex.cpp b/util/system/mutex.cpp index 4041402db9..9b36c272a5 100644 --- a/util/system/mutex.cpp +++ b/util/system/mutex.cpp @@ -7,14 +7,14 @@ #include "winint.h" #else #include <pthread.h> -#endif - +#endif + class TMutex::TImpl { public: inline TImpl() { #if defined(_win_) InitializeCriticalSection(&Obj); -#else +#else struct T { pthread_mutexattr_t Attr; @@ -43,25 +43,25 @@ public: if (result != 0) { ythrow yexception() << "mutex init failed(" << LastSystemErrorText(result) << ")"; } -#endif +#endif } - + inline ~TImpl() { #if defined(_win_) DeleteCriticalSection(&Obj); -#else +#else int result = pthread_mutex_destroy(&Obj); Y_VERIFY(result == 0, "mutex destroy failure (%s)", LastSystemErrorText(result)); -#endif +#endif } inline void Acquire() noexcept { #if defined(_win_) EnterCriticalSection(&Obj); -#else +#else int result = pthread_mutex_lock(&Obj); Y_VERIFY(result == 0, "mutex lock failure (%s)", LastSystemErrorText(result)); -#endif +#endif } #if defined(_win_) @@ -90,22 +90,22 @@ public: inline bool TryAcquire() noexcept { #if defined(_win_) return TryEnterCriticalSectionInt(&Obj); -#else +#else int result = pthread_mutex_trylock(&Obj); if (result == 0 || result == EBUSY) { return result == 0; } Y_FAIL("mutex trylock failure (%s)", LastSystemErrorText(result)); -#endif +#endif } inline void Release() noexcept { #if defined(_win_) LeaveCriticalSection(&Obj); -#else +#else int result = pthread_mutex_unlock(&Obj); Y_VERIFY(result == 0, "mutex unlock failure (%s)", LastSystemErrorText(result)); -#endif +#endif } inline void* Handle() const noexcept { @@ -123,8 +123,8 @@ private: TMutex::TMutex() : Impl_(new TImpl()) { -} - +} + TMutex::TMutex(TMutex&&) = default; TMutex::~TMutex() = default; diff --git a/util/system/mutex.h b/util/system/mutex.h index 032630d134..4d11fc9c7a 100644 --- a/util/system/mutex.h +++ b/util/system/mutex.h @@ -1,16 +1,16 @@ #pragma once - + #include "guard.h" #include "defaults.h" #include <util/generic/ptr.h> #include <util/generic/noncopyable.h> - + class TFakeMutex: public TNonCopyable { public: inline void Acquire() noexcept { } - + inline bool TryAcquire() noexcept { return true; } @@ -32,7 +32,7 @@ public: ~TFakeMutex() = default; }; - + class TMutex { public: TMutex(); diff --git a/util/system/sys_alloc.h b/util/system/sys_alloc.h index 4221a28f8c..3698960e8a 100644 --- a/util/system/sys_alloc.h +++ b/util/system/sys_alloc.h @@ -1,5 +1,5 @@ #pragma once - + #include <util/system/compiler.h> #include <cstdlib> diff --git a/util/system/tls.h b/util/system/tls.h index 3c4f56dbeb..17d58e3a0c 100644 --- a/util/system/tls.h +++ b/util/system/tls.h @@ -1,5 +1,5 @@ #pragma once - + #include "defaults.h" #include <util/generic/ptr.h> @@ -176,7 +176,7 @@ namespace NTls { } }; - template <class T> + template <class T> class TValue: public TMoveOnly { class TConstructor { public: @@ -227,12 +227,12 @@ namespace NTls { : Constructor_(new TCopyConstructor<T1>(value)) , Key_(Dtor) { - } + } template <class T1> inline T& operator=(const T1& val) { return Get() = val; - } + } inline operator const T&() const { return Get(); @@ -275,7 +275,7 @@ namespace NTls { } return val; - } + } private: static void Dtor(void* ptr) { @@ -283,12 +283,12 @@ namespace NTls { ((T*)ptr)->~T(); ::NPrivate::FillWithTrash(ptr, sizeof(T)); - } + } private: THolder<TConstructor> Constructor_; TKey Key_; - }; + }; } template <class T> diff --git a/util/system/yassert.h b/util/system/yassert.h index 529823440c..8d54977cc9 100644 --- a/util/system/yassert.h +++ b/util/system/yassert.h @@ -1,5 +1,5 @@ #pragma once - + #include "defaults.h" #include "src_root.h" #include "backtrace.h" @@ -21,7 +21,7 @@ #endif #include <cassert> #endif - + #if !defined(_MSC_VER) #if defined(__has_builtin) && __has_builtin(__debugbreak) // Do nothing, use __debugbreak builtin |