summaryrefslogtreecommitdiffstats
path: root/util/system/mlock.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <[email protected]>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /util/system/mlock.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'util/system/mlock.cpp')
-rw-r--r--util/system/mlock.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/util/system/mlock.cpp b/util/system/mlock.cpp
index 03e68d8f509..435338c98fb 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
}