aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/util.cpp15
-rw-r--r--src/common/util.h2
2 files changed, 17 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);
diff --git a/src/common/util.h b/src/common/util.h
index e793a42b5..1c5c5f4e7 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -221,6 +221,8 @@ namespace tools
void set_strict_default_file_permissions(bool strict);
+ ssize_t get_lockable_memory();
+
void set_max_concurrency(unsigned n);
unsigned get_max_concurrency();