aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-11-03 18:32:05 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-11-03 20:09:28 +0000
commit177a9d76f99ce259598f85f99b1d2ecf77a7fdd2 (patch)
tree8454656b13eb6376ab8599c066c8b7815efb94e6 /src/common/util.cpp
parentMerge pull request #4676 (diff)
downloadmonero-177a9d76f99ce259598f85f99b1d2ecf77a7fdd2.tar.xz
wallet: warn if lockable memory limit is too low
Diffstat (limited to '')
-rw-r--r--src/common/util.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp
index 43973c511..58b0d8210 100644
--- a/src/common/util.cpp
+++ b/src/common/util.cpp
@@ -728,6 +728,21 @@ std::string get_nix_version_display_string()
return true;
}
+ ssize_t get_lockable_memory()
+ {
+#ifdef __GLIBC__
+ struct rlimit rlim;
+ if (getrlimit(RLIMIT_MEMLOCK, &rlim) < 0)
+ {
+ MERROR("Failed to determine the lockable memory limit");
+ return -1;
+ }
+ return rlim.rlim_cur;
+#else
+ return -1;
+#endif
+ }
+
bool on_startup()
{
mlog_configure("", true);