diff options
author | Suren Baghdasaryan <surenb@google.com> | 2020-04-30 11:58:39 -0700 |
---|---|---|
committer | Suren Baghdasaryan <surenb@google.com> | 2020-04-30 22:24:21 +0000 |
commit | c9c0bbac5383a3688b7ef836b348ebbc075c1a8e (patch) | |
tree | fcd3926b7d6d0bbb3e79a8eb0a92240ddb4cb8d5 /init/service_parser.cpp | |
parent | 1a342a12f35c7d118e6367b3b68e9e6a47b4058a (diff) |
init: Add task_profiles init command
Introduce new command to allow setting task profiles from inside .rc
script. This is to replace usage of writepid when a service is trying
to join a cgroup. Usage example from a .rc file:
service surfaceflinger /system/bin/surfaceflinger
task_profiles HighPerformance
Bug: 155419956
Test: change .rc file and confirm task profile is applied
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I0add9c3b363a7cb1ea89778780896cae1c8a303c
Diffstat (limited to 'init/service_parser.cpp')
-rw-r--r-- | init/service_parser.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/init/service_parser.cpp b/init/service_parser.cpp index 560f693f9..144425874 100644 --- a/init/service_parser.cpp +++ b/init/service_parser.cpp @@ -360,6 +360,12 @@ Result<void> ServiceParser::ParseShutdown(std::vector<std::string>&& args) { return Error() << "Invalid shutdown option"; } +Result<void> ServiceParser::ParseTaskProfiles(std::vector<std::string>&& args) { + args.erase(args.begin()); + service_->task_profiles_ = std::move(args); + return {}; +} + Result<void> ServiceParser::ParseTimeoutPeriod(std::vector<std::string>&& args) { int period; if (!ParseInt(args[1], &period, 1)) { @@ -529,6 +535,7 @@ const KeywordMap<ServiceParser::OptionParser>& ServiceParser::GetParserMap() con {"sigstop", {0, 0, &ServiceParser::ParseSigstop}}, {"socket", {3, 6, &ServiceParser::ParseSocket}}, {"stdio_to_kmsg", {0, 0, &ServiceParser::ParseStdioToKmsg}}, + {"task_profiles", {1, kMax, &ServiceParser::ParseTaskProfiles}}, {"timeout_period", {1, 1, &ServiceParser::ParseTimeoutPeriod}}, {"updatable", {0, 0, &ServiceParser::ParseUpdatable}}, {"user", {1, 1, &ServiceParser::ParseUser}}, |