aboutsummaryrefslogtreecommitdiffstats
path: root/util/system
diff options
context:
space:
mode:
authordenplusplus <denplusplus@yandex-team.ru>2022-02-10 16:47:34 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:34 +0300
commit57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a (patch)
treecc63639f8e502db19a82c20e2861c6d1edbf9fea /util/system
parent464ba3814a83db4f2d5327393b0b6eaf0c86bfd7 (diff)
downloadydb-57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a.tar.gz
Restoring authorship annotation for <denplusplus@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system')
-rw-r--r--util/system/compat.cpp12
-rw-r--r--util/system/compat.h10
-rw-r--r--util/system/context_i686.asm38
-rw-r--r--util/system/context_x86_64.asm16
-rw-r--r--util/system/defaults.h8
-rw-r--r--util/system/error.cpp12
-rw-r--r--util/system/error.h2
-rw-r--r--util/system/filemap.cpp28
-rw-r--r--util/system/filemap.h18
-rw-r--r--util/system/hostname.cpp4
-rw-r--r--util/system/tls.cpp2
-rw-r--r--util/system/yassert.h8
12 files changed, 79 insertions, 79 deletions
diff --git a/util/system/compat.cpp b/util/system/compat.cpp
index 18fbfa296a..b6e178d5d7 100644
--- a/util/system/compat.cpp
+++ b/util/system/compat.cpp
@@ -11,18 +11,18 @@
#include <util/generic/string.h>
-#ifdef _win_
+#ifdef _win_
#include "winint.h"
#include <io.h>
-#endif
-
+#endif
+
#ifndef HAVE_NATIVE_GETPROGNAME
const char* getprogname() {
return GetProgramName().data();
}
#endif
-#ifdef _win_
+#ifdef _win_
void sleep(i64 len) {
Sleep((unsigned long)len * 1000);
@@ -35,11 +35,11 @@ void usleep(i64 len) {
#include <fcntl.h>
int ftruncate(int fd, i64 length) {
return _chsize_s(fd, length);
-}
+}
int truncate(const char* name, i64 length) {
int fd = ::_open(name, _O_WRONLY);
int ret = ftruncate(fd, length);
::close(fd);
return ret;
}
-#endif
+#endif
diff --git a/util/system/compat.h b/util/system/compat.h
index c53dbcca17..e77dbd251b 100644
--- a/util/system/compat.h
+++ b/util/system/compat.h
@@ -54,14 +54,14 @@ extern "C" {
#define pclose _pclose
#endif
-#ifdef _win_
+#ifdef _win_
#define NAME_MAX FILENAME_MAX
#endif
#ifdef _sun_
#define NAME_MAX PATH_MAX
#endif
-#ifdef _win_
+#ifdef _win_
#ifdef sleep // may be defined by perl
#undef sleep
@@ -72,11 +72,11 @@ void usleep(i64 len);
#endif
-#ifdef _win_
+#ifdef _win_
int ftruncate(int fd, i64 length);
int truncate(const char* name, i64 length);
-#endif
-
+#endif
+
#if defined(GNUC)
#ifndef va_copy
#define va_copy __va_copy
diff --git a/util/system/context_i686.asm b/util/system/context_i686.asm
index 11f8cecc8e..6a334981ba 100644
--- a/util/system/context_i686.asm
+++ b/util/system/context_i686.asm
@@ -19,25 +19,25 @@
%define VAL JBUF + PTR_SIZE
EXPORT __mylongjmp
- mov ecx, [esp + JBUF]
- mov eax, [esp + VAL]
- mov edx, [ecx + MJB_PC*4]
- mov ebx, [ecx + MJB_BX*4]
- mov esi, [ecx + MJB_SI*4]
- mov edi, [ecx + MJB_DI*4]
- mov ebp, [ecx + MJB_BP*4]
- mov esp, [ecx + MJB_SP*4]
+ mov ecx, [esp + JBUF]
+ mov eax, [esp + VAL]
+ mov edx, [ecx + MJB_PC*4]
+ mov ebx, [ecx + MJB_BX*4]
+ mov esi, [ecx + MJB_SI*4]
+ mov edi, [ecx + MJB_DI*4]
+ mov ebp, [ecx + MJB_BP*4]
+ mov esp, [ecx + MJB_SP*4]
jmp edx
EXPORT __mysetjmp
- mov eax, [esp + JMPBUF]
- mov [eax + MJB_BX*4], ebx
- mov [eax + MJB_SI*4], esi
- mov [eax + MJB_DI*4], edi
- lea ecx, [esp + JMPBUF]
- mov [eax + MJB_SP*4], ecx
- mov ecx, [esp + PCOFF]
- mov [eax + MJB_PC*4], ecx
- mov [eax + MJB_BP*4], ebp
- xor eax, eax
- ret
+ mov eax, [esp + JMPBUF]
+ mov [eax + MJB_BX*4], ebx
+ mov [eax + MJB_SI*4], esi
+ mov [eax + MJB_DI*4], edi
+ lea ecx, [esp + JMPBUF]
+ mov [eax + MJB_SP*4], ecx
+ mov ecx, [esp + PCOFF]
+ mov [eax + MJB_PC*4], ecx
+ mov [eax + MJB_BP*4], ebp
+ xor eax, eax
+ ret
diff --git a/util/system/context_x86_64.asm b/util/system/context_x86_64.asm
index 8bcc01e4fc..616e553639 100644
--- a/util/system/context_x86_64.asm
+++ b/util/system/context_x86_64.asm
@@ -1,13 +1,13 @@
[bits 64]
- %define MJB_RBX 0
- %define MJB_RBP 1
- %define MJB_R12 2
- %define MJB_R13 3
- %define MJB_R14 4
- %define MJB_R15 5
- %define MJB_RSP 6
- %define MJB_PC 7
+ %define MJB_RBX 0
+ %define MJB_RBP 1
+ %define MJB_R12 2
+ %define MJB_R13 3
+ %define MJB_R14 4
+ %define MJB_R15 5
+ %define MJB_RSP 6
+ %define MJB_PC 7
%define MJB_SIZE (8*8)
EXPORT __mylongjmp
diff --git a/util/system/defaults.h b/util/system/defaults.h
index dcd7abea38..ca18b0dac2 100644
--- a/util/system/defaults.h
+++ b/util/system/defaults.h
@@ -81,18 +81,18 @@
#include <alloca.h>
#endif
-#ifdef NDEBUG
+#ifdef NDEBUG
#define Y_IF_DEBUG(X)
#ifdef __cplusplus
constexpr bool Y_IS_DEBUG_BUILD = false;
#endif
-#else
+#else
#define Y_IF_DEBUG(X) X
#ifdef __cplusplus
constexpr bool Y_IS_DEBUG_BUILD = true;
#endif
-#endif
-
+#endif
+
/**
* @def Y_ARRAY_SIZE
*
diff --git a/util/system/error.cpp b/util/system/error.cpp
index f778ec42cb..0cbe9fe63e 100644
--- a/util/system/error.cpp
+++ b/util/system/error.cpp
@@ -16,14 +16,14 @@
#include <unistd.h>
#endif
-void ClearLastSystemError() {
-#if defined(_win_)
- SetLastError(0);
+void ClearLastSystemError() {
+#if defined(_win_)
+ SetLastError(0);
#else
errno = 0;
-#endif
-}
-
+#endif
+}
+
int LastSystemError() {
#if defined(_win_)
int ret = GetLastError();
diff --git a/util/system/error.h b/util/system/error.h
index 5f2d4cc547..299900a5f3 100644
--- a/util/system/error.h
+++ b/util/system/error.h
@@ -81,7 +81,7 @@
#define EDQUOT WSAEDQUOT
#endif
-void ClearLastSystemError();
+void ClearLastSystemError();
int LastSystemError();
void LastSystemErrorText(char* str, size_t size, int code);
const char* LastSystemErrorText(int code);
diff --git a/util/system/filemap.cpp b/util/system/filemap.cpp
index 7454a4cb94..3cdba4efdd 100644
--- a/util/system/filemap.cpp
+++ b/util/system/filemap.cpp
@@ -248,7 +248,7 @@ public:
if (result.Ptr == (char*)(-1)) {
result.Ptr = nullptr;
- }
+ }
#if defined(_unix_)
} else {
result.Ptr = PtrStart_ ? static_cast<caddr_t>(PtrStart_) + base : nullptr;
@@ -314,7 +314,7 @@ public:
if (PtrStart_) {
munmap((caddr_t)PtrStart_, Length_);
}
-#endif
+#endif
}
inline i64 Length() const noexcept {
@@ -345,7 +345,7 @@ private:
void* PtrStart_;
#endif
};
-
+
TMemoryMap::TMemoryMap(const TString& name)
: Impl_(new TImpl(name, EOpenModeFlag::oRdOnly))
{
@@ -355,7 +355,7 @@ TMemoryMap::TMemoryMap(const TString& name, EOpenMode om)
: Impl_(new TImpl(name, om))
{
}
-
+
TMemoryMap::TMemoryMap(const TString& name, i64 length, EOpenMode om)
: Impl_(new TImpl(name, length, om))
{
@@ -453,27 +453,27 @@ TFileMap::TFileMap(const TString& name, EOpenMode om)
: Map_(name, om)
{
}
-
+
TFileMap::TFileMap(const TString& name, i64 length, EOpenMode om)
: Map_(name, length, om)
{
}
-
+
TFileMap::TFileMap(FILE* f, EOpenMode om, TString dbgName)
: Map_(f, om, dbgName)
{
}
-
+
TFileMap::TFileMap(const TFile& file, EOpenMode om, TString dbgName)
: Map_(file, om, dbgName)
{
}
-
+
TFileMap::TFileMap(const TFileMap& fm) noexcept
: Map_(fm.Map_)
{
}
-
+
void TFileMap::Flush(void* ptr, size_t size, bool sync) {
Y_ASSERT(ptr >= Ptr());
Y_ASSERT(static_cast<char*>(ptr) + size <= static_cast<char*>(Ptr()) + MappedSize());
@@ -486,11 +486,11 @@ void TFileMap::Flush(void* ptr, size_t size, bool sync) {
if (sync) {
FlushViewOfFile(ptr, size);
}
-#else
+#else
msync(ptr, size, sync ? MS_SYNC : MS_ASYNC);
-#endif
+#endif
}
-
+
TFileMap::TMapResult TFileMap::Map(i64 offset, size_t size) {
Unmap();
Region_ = Map_.Map(offset, size);
@@ -508,14 +508,14 @@ void TFileMap::Unmap() {
if (!Region_.IsMapped()) {
return;
}
-
+
if (Map_.Unmap(Region_)) {
Region_.Reset();
} else {
ythrow yexception() << "can't unmap file";
}
}
-
+
TFileMap::~TFileMap() {
try {
// explicit Unmap() is required because in oNotGreedy mode the Map_ object doesn't own the mapped area
diff --git a/util/system/filemap.h b/util/system/filemap.h
index 11be64bff4..2d99051a11 100644
--- a/util/system/filemap.h
+++ b/util/system/filemap.h
@@ -49,13 +49,13 @@ struct TMemoryMapCommon {
};
enum EOpenModeFlag {
- oRdOnly = 1,
- oRdWr = 2,
+ oRdOnly = 1,
+ oRdWr = 2,
oCopyOnWr = 4,
oAccessMask = 7,
- oNotGreedy = 8,
- oPrecharge = 16,
+ oNotGreedy = 8,
+ oPrecharge = 16,
oPopulate = 32, // Populate page table entries (see mmap's MAP_POPULATE)
};
Y_DECLARE_FLAGS(EOpenMode, EOpenModeFlag)
@@ -115,7 +115,7 @@ public:
TFileMap(FILE* f, EOpenMode om = oRdOnly, TString dbgName = UnknownFileName());
TFileMap(const TFile& file, EOpenMode om = oRdOnly, TString dbgName = UnknownFileName());
TFileMap(const TFileMap& fm) noexcept;
-
+
~TFileMap();
TMapResult Map(i64 offset, size_t size);
@@ -145,7 +145,7 @@ public:
inline bool IsOpen() const noexcept {
return Map_.IsOpen();
}
-
+
inline bool IsWritable() const noexcept {
return Map_.IsWritable();
}
@@ -157,7 +157,7 @@ public:
inline void* Ptr() const noexcept {
return Region_.MappedData();
}
-
+
inline size_t MappedSize() const noexcept {
return Region_.MappedSize();
}
@@ -232,7 +232,7 @@ public:
size_t Size() const {
return Size_;
}
- const T& GetAt(size_t pos) const {
+ const T& GetAt(size_t pos) const {
if (pos < Size_)
return Ptr_[pos];
return Dummy();
@@ -258,7 +258,7 @@ public:
Y_PURE_FUNCTION bool Empty() const noexcept {
return 0 == Size_;
- }
+ }
/// for STL compatibility only, Begin() usage is recommended
const T* begin() const noexcept {
return Begin();
diff --git a/util/system/hostname.cpp b/util/system/hostname.cpp
index 386f646d6b..308fea7cf5 100644
--- a/util/system/hostname.cpp
+++ b/util/system/hostname.cpp
@@ -11,8 +11,8 @@
#if defined(_win_)
#include <WinSock2.h>
-#endif
-
+#endif
+
#include "defaults.h"
#include "yassert.h"
#include "hostname.h"
diff --git a/util/system/tls.cpp b/util/system/tls.cpp
index c2f1a04a14..3dbf738d5c 100644
--- a/util/system/tls.cpp
+++ b/util/system/tls.cpp
@@ -111,7 +111,7 @@ namespace {
return MyStorageSlow();
#endif
}
-
+
virtual TPerThreadStorage* MyStorageSlow() = 0;
virtual ~TGenericTlsBase() = default;
diff --git a/util/system/yassert.h b/util/system/yassert.h
index 529823440c..2194a90b76 100644
--- a/util/system/yassert.h
+++ b/util/system/yassert.h
@@ -101,13 +101,13 @@ namespace NPrivate {
::NPrivate::Panic(__SOURCE_FILE_IMPL__, __LINE__, __FUNCTION__, #expr, " " __VA_ARGS__); \
} \
} while (false)
-
+
#define Y_FAIL(...) \
do { \
::NPrivate::Panic(__SOURCE_FILE_IMPL__, __LINE__, __FUNCTION__, nullptr, " " __VA_ARGS__); \
} while (false)
-#ifndef NDEBUG
+#ifndef NDEBUG
/// Assert that depend on NDEBUG macro and outputs message like printf
#define Y_VERIFY_DEBUG(expr, ...) \
do { \
@@ -115,7 +115,7 @@ namespace NPrivate {
::NPrivate::Panic(__SOURCE_FILE_IMPL__, __LINE__, __FUNCTION__, #expr, " " __VA_ARGS__); \
} \
} while (false)
-#else
+#else
#define Y_VERIFY_DEBUG(expr, ...) \
do { \
if (false) { \
@@ -123,4 +123,4 @@ namespace NPrivate {
Y_UNUSED(__xxx); \
} \
} while (false)
-#endif
+#endif