]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
util: add func for checking OOMScoreAdjust
authorEvgeny Vereshchagin <evvers@ya.ru>
Sat, 17 Oct 2015 20:01:41 +0000 (20:01 +0000)
committerEvgeny Vereshchagin <evvers@ya.ru>
Sat, 17 Oct 2015 20:03:40 +0000 (20:03 +0000)
src/basic/util.c
src/basic/util.h

index 8b896a2df35015ef33e6d74042924090ac263a7b..2565b0f5479746773787c1c9da548f6ad2820678 100644 (file)
@@ -29,6 +29,7 @@
 #include <libintl.h>
 #include <limits.h>
 #include <linux/magic.h>
+#include <linux/oom.h>
 #include <linux/sched.h>
 #include <locale.h>
 #include <netinet/ip.h>
@@ -6800,3 +6801,7 @@ bool fdname_is_valid(const char *s) {
 
         return p - s < 256;
 }
+
+bool oom_score_adjust_is_valid(int oa) {
+        return oa >= OOM_SCORE_ADJ_MIN && oa <= OOM_SCORE_ADJ_MAX;
+}
index 2544ad083016df8b1f2b59bc265357323f581d71..6c63bc221f2cc6e9d8de157dd2e018a5776091df 100644 (file)
@@ -941,3 +941,5 @@ void nop_signal_handler(int sig);
 int version(void);
 
 bool fdname_is_valid(const char *s);
+
+bool oom_score_adjust_is_valid(int oa);