Merge pull request #4790

177a9d76 wallet: warn if lockable memory limit is too low (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-11-16 11:08:07 +02:00
commit 9aff9a5372
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
3 changed files with 25 additions and 0 deletions

View file

@ -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);

View file

@ -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();