diff options
author | Elliott Hughes <enh@google.com> | 2015-06-12 18:02:20 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2015-06-17 14:42:40 -0700 |
commit | d62f0608d9d67bf647cf15debbd163e84584fe44 (patch) | |
tree | 5422f5f2b5173b001ca2fa7c170c91d9713883c7 /init/init_parser.cpp | |
parent | 106f92f5c8f116acf8ba01090aab30ad57d0fed8 (diff) | |
download | core-d62f0608d9d67bf647cf15debbd163e84584fe44.tar.gz core-d62f0608d9d67bf647cf15debbd163e84584fe44.tar.bz2 core-d62f0608d9d67bf647cf15debbd163e84584fe44.zip |
init support for cgroups.
This adds the "writepid" option that instructs init to write the child's
pid to the given filenames (such as /dev/cpuctl/bg_non_interactive/cgroup.procs
and/or /dev/cpuset/foreground/cgroup.procs).
Bug: http://b/21163745
Change-Id: I121bb22aa208bc99c4fb334eb552fdd5bcc47c1a
Diffstat (limited to 'init/init_parser.cpp')
-rw-r--r-- | init/init_parser.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/init/init_parser.cpp b/init/init_parser.cpp index f975b6c0b..956ed255a 100644 --- a/init/init_parser.cpp +++ b/init/init_parser.cpp @@ -206,6 +206,7 @@ static int lookup_keyword(const char *s) break; case 'w': if (!strcmp(s, "rite")) return K_write; + if (!strcmp(s, "ritepid")) return K_writepid; if (!strcmp(s, "ait")) return K_wait; break; } @@ -924,6 +925,16 @@ static void parse_line_service(struct parse_state *state, int nargs, char **args svc->seclabel = args[1]; } break; + case K_writepid: + if (nargs < 2) { + parse_error(state, "writepid option requires at least one filename\n"); + break; + } + svc->writepid_files_ = new std::vector<std::string>; + for (int i = 1; i < nargs; ++i) { + svc->writepid_files_->push_back(args[i]); + } + break; default: parse_error(state, "invalid option '%s'\n", args[0]); |