diff options
author | denplusplus <denplusplus@yandex-team.ru> | 2022-02-10 16:47:34 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:34 +0300 |
commit | 57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a (patch) | |
tree | cc63639f8e502db19a82c20e2861c6d1edbf9fea /util/system/filemap.cpp | |
parent | 464ba3814a83db4f2d5327393b0b6eaf0c86bfd7 (diff) | |
download | ydb-57c20d143e8a438cd76b9fdc3ca2e8ee3ac1f32a.tar.gz |
Restoring authorship annotation for <denplusplus@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/filemap.cpp')
-rw-r--r-- | util/system/filemap.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
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 |