diff options
author | Alexey Salmin <alexey.salmin@gmail.com> | 2022-02-10 16:49:37 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:37 +0300 |
commit | 3c5b1607b38f637d2f3313791ed25c2e080d2647 (patch) | |
tree | 99be7b96e7c66612fbca94331100ef3b5fedcb88 /util/system/mincore.cpp | |
parent | de89752358147d7b25ef59a85b431bb564068a49 (diff) | |
download | ydb-3c5b1607b38f637d2f3313791ed25c2e080d2647.tar.gz |
Restoring authorship annotation for Alexey Salmin <alexey.salmin@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'util/system/mincore.cpp')
-rw-r--r-- | util/system/mincore.cpp | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/util/system/mincore.cpp b/util/system/mincore.cpp index 8cbae72586..7dfb241c86 100644 --- a/util/system/mincore.cpp +++ b/util/system/mincore.cpp @@ -1,35 +1,35 @@ -#include "align.h" -#include "compiler.h" -#include "info.h" -#include "mincore.h" - -#include <util/generic/yexception.h> - -#include <cstring> - -#if defined(_unix_) +#include "align.h" +#include "compiler.h" +#include "info.h" +#include "mincore.h" + +#include <util/generic/yexception.h> + +#include <cstring> + +#if defined(_unix_) #include <sys/unistd.h> #include <sys/mman.h> #if defined(_android_) #include <sys/syscall.h> #endif -#endif - -void InCoreMemory(const void* addr, size_t len, unsigned char* vec, size_t vecLen) { -#if defined(_linux_) - const size_t pageSize = NSystemInfo::GetPageSize(); - void* maddr = const_cast<void*>(AlignDown(addr, pageSize)); - len = AlignUp(len, pageSize); - if (vecLen * pageSize < len) { - ythrow yexception() << "vector argument for mincore is too small: " << vecLen * pageSize << " < " << len; - } - if (::mincore(maddr, len, vec)) { - ythrow yexception() << LastSystemErrorText(); - } -#else - // pessimistic assumption: nothing is in core - Y_UNUSED(addr); - Y_UNUSED(len); - ::memset(vec, 0, vecLen); -#endif -} +#endif + +void InCoreMemory(const void* addr, size_t len, unsigned char* vec, size_t vecLen) { +#if defined(_linux_) + const size_t pageSize = NSystemInfo::GetPageSize(); + void* maddr = const_cast<void*>(AlignDown(addr, pageSize)); + len = AlignUp(len, pageSize); + if (vecLen * pageSize < len) { + ythrow yexception() << "vector argument for mincore is too small: " << vecLen * pageSize << " < " << len; + } + if (::mincore(maddr, len, vec)) { + ythrow yexception() << LastSystemErrorText(); + } +#else + // pessimistic assumption: nothing is in core + Y_UNUSED(addr); + Y_UNUSED(len); + ::memset(vec, 0, vecLen); +#endif +} |