summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2015-10-17 20:01:41 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2015-10-17 20:03:40 +0000
commit257b0719cb9832b7d5e142c77a38d387c531c631 (patch)
treec03405281f57d07907d87c737ccef23be3657c59 /src
parenteacb22c21b31bba5d0387982c6b0b4faa452cb5e (diff)
util: add func for checking OOMScoreAdjust
Diffstat (limited to 'src')
-rw-r--r--src/basic/util.c5
-rw-r--r--src/basic/util.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/basic/util.c b/src/basic/util.c
index 8b896a2df3..2565b0f547 100644
--- a/src/basic/util.c
+++ b/src/basic/util.c
@@ -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;
+}
diff --git a/src/basic/util.h b/src/basic/util.h
index 2544ad0830..6c63bc221f 100644
--- a/src/basic/util.h
+++ b/src/basic/util.h
@@ -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);