summaryrefslogtreecommitdiff
path: root/init/service_parser.cpp
diff options
context:
space:
mode:
authorSuren Baghdasaryan <surenb@google.com>2019-10-22 17:18:42 -0700
committerSuren Baghdasaryan <surenb@google.com>2019-11-07 18:19:31 +0000
commitc29c2baa6907a2f4c0a4efca9fa41fc5474ec1c4 (patch)
tree1c5a37c465cba55fca2bb83294363f4eed2c1e87 /init/service_parser.cpp
parente353d8642ce6b77711dd443e9b4433a03dced92a (diff)
init: Add support for native service registration with lmkd
init should be able to register native services with lmkd so that they can be killed when needed. Only processes with oom_score_adjust not equal to the default -1000 will be registered with lmkd because with the score that low the process is unkillable anyway. Inform lmkd when a registered process is killed so that the record can be removed. Change init.rc to start lmkd during init phase so that it is there to register other services. Replace hardcoded oom_score_adj values with appropriate definitions. Bug: 129011369 Test: boot and verify native service registration Change-Id: Ie5ed62203395120d86dc1c8250fae01aa0b3c511 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Diffstat (limited to 'init/service_parser.cpp')
-rw-r--r--init/service_parser.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/init/service_parser.cpp b/init/service_parser.cpp
index e6a341d77..154d1dd41 100644
--- a/init/service_parser.cpp
+++ b/init/service_parser.cpp
@@ -29,6 +29,7 @@
#include <hidl-util/FQName.h>
#include <system/thread_defs.h>
+#include "lmkd_service.h"
#include "rlimit_parser.h"
#include "service_utils.h"
#include "util.h"
@@ -261,8 +262,10 @@ Result<void> ServiceParser::ParseNamespace(std::vector<std::string>&& args) {
}
Result<void> ServiceParser::ParseOomScoreAdjust(std::vector<std::string>&& args) {
- if (!ParseInt(args[1], &service_->oom_score_adjust_, -1000, 1000)) {
- return Error() << "oom_score_adjust value must be in range -1000 - +1000";
+ if (!ParseInt(args[1], &service_->oom_score_adjust_, MIN_OOM_SCORE_ADJUST,
+ MAX_OOM_SCORE_ADJUST)) {
+ return Error() << "oom_score_adjust value must be in range " << MIN_OOM_SCORE_ADJUST
+ << " - +" << MAX_OOM_SCORE_ADJUST;
}
return {};
}