]> git.sesse.net Git - nageru/commitdiff
If running with unlimited amounts of lockable memory (e.g. as root), give a less...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 26 Dec 2016 14:12:09 +0000 (15:12 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Mon, 26 Dec 2016 14:12:09 +0000 (15:12 +0100)
mixer.cpp

index db7a060ce392aae209b38d94cfc95ec60d73cf09..875fc6f8a6f6f6d914d01c9b07dd09a56f5e79f0 100644 (file)
--- 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));