From 4bfa989f060c88bd1644ed03f66faa6192b1244f Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Mon, 26 Dec 2016 15:12:09 +0100 Subject: [PATCH] If running with unlimited amounts of lockable memory (e.g. as root), give a less confusing status message. --- mixer.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mixer.cpp b/mixer.cpp index db7a060..875fc6f 100644 --- a/mixer.cpp +++ b/mixer.cpp @@ -680,10 +680,15 @@ void Mixer::thread_func() assert(false); } - printf(", using %ld / %ld MB lockable memory (%.1f%%)", - long(used.ru_maxrss / 1024), - long(limit.rlim_cur / 1048576), - float(100.0 * (used.ru_maxrss * 1024.0) / limit.rlim_cur)); + if (limit.rlim_cur == 0) { + printf(", using %ld MB memory (locked)", + long(used.ru_maxrss / 1024)); + } else { + printf(", using %ld / %ld MB lockable memory (%.1f%%)", + long(used.ru_maxrss / 1024), + long(limit.rlim_cur / 1048576), + float(100.0 * (used.ru_maxrss * 1024.0) / limit.rlim_cur)); + } } else { printf(", using %ld MB memory (not locked)", long(used.ru_maxrss / 1024)); -- 2.39.2