diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/system/mlock.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/mlock.cpp')
-rw-r--r-- | util/system/mlock.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/util/system/mlock.cpp b/util/system/mlock.cpp index 435338c98f..03e68d8f50 100644 --- a/util/system/mlock.cpp +++ b/util/system/mlock.cpp @@ -5,24 +5,24 @@ #include "mlock.h" #if defined(_unix_) - #include <sys/mman.h> - #if !defined(MCL_ONFAULT) && defined(MCL_FUTURE) // Old glibc. - #define MCL_ONFAULT (MCL_FUTURE << 1) - #endif - #if defined(_android_) - #include <sys/syscall.h> - #define munlockall() syscall(__NR_munlockall) - #endif + #include <sys/mman.h> + #if !defined(MCL_ONFAULT) && defined(MCL_FUTURE) // Old glibc. + #define MCL_ONFAULT (MCL_FUTURE << 1) + #endif + #if defined(_android_) + #include <sys/syscall.h> + #define munlockall() syscall(__NR_munlockall) + #endif #else - #include "winint.h" + #include "winint.h" #endif -void LockMemory(const void* addr, size_t len) { +void LockMemory(const void* addr, size_t len) { #if defined(_unix_) const size_t pageSize = NSystemInfo::GetPageSize(); - if (mlock(AlignDown(addr, pageSize), AlignUp(len, pageSize))) { + if (mlock(AlignDown(addr, pageSize), AlignUp(len, pageSize))) { ythrow yexception() << LastSystemErrorText(); - } + } #elif defined(_win_) HANDLE hndl = GetCurrentProcess(); SIZE_T min, max; @@ -35,11 +35,11 @@ void LockMemory(const void* addr, size_t len) { #endif } -void UnlockMemory(const void* addr, size_t len) { +void UnlockMemory(const void* addr, size_t len) { #if defined(_unix_) - if (munlock(addr, len)) { + if (munlock(addr, len)) { ythrow yexception() << LastSystemErrorText(); - } + } #elif defined(_win_) HANDLE hndl = GetCurrentProcess(); SIZE_T min, max; @@ -55,9 +55,9 @@ void UnlockMemory(const void* addr, size_t len) { void LockAllMemory(ELockAllMemoryFlags flags) { Y_UNUSED(flags); #if defined(_android_) -// unimplemented +// unimplemented #elif defined(_cygwin_) -// unimplemented +// unimplemented #elif defined(_unix_) int sys_flags = 0; if (flags & LockCurrentMemory) { @@ -75,12 +75,12 @@ void LockAllMemory(ELockAllMemoryFlags flags) { #endif } -void UnlockAllMemory() { -#if defined(_cygwin_) -// unimplemented -#elif defined(_unix_) - if (munlockall()) { +void UnlockAllMemory() { +#if defined(_cygwin_) +// unimplemented +#elif defined(_unix_) + if (munlockall()) { ythrow yexception() << LastSystemErrorText(); - } + } #endif } |