Warn on startup if RLIMIT_MEMLOCK is set too low

This should diagnose issues like #119.
This commit is contained in:
Robbert van der Helm
2021-07-18 23:12:10 +02:00
parent 5bce89d50b
commit 0e57f410a9
4 changed files with 60 additions and 5 deletions
+9
View File
@@ -57,6 +57,15 @@ bool set_realtime_priority(bool sched_fifo, int priority) noexcept {
&params) == 0;
}
std::optional<rlim_t> get_memlock_limit() noexcept {
rlimit limits{};
if (getrlimit(RLIMIT_MEMLOCK, &limits) == 0) {
return limits.rlim_cur;
} else {
return std::nullopt;
}
}
std::optional<rlim_t> get_rttime_limit() noexcept {
rlimit limits{};
if (getrlimit(RLIMIT_RTTIME, &limits) == 0) {