diff options
| author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-03-29 18:39:30 +0000 |
|---|---|---|
| committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-03-29 18:39:32 +0000 |
| commit | f3570cb522f44863eca33dcd33b49b492f7a7dd1 (patch) | |
| tree | 1c4327eb457bf0af133b093c253441a3cc7b9921 /init/builtins.cpp | |
| parent | 9c9d265efc3a42e55e2de1e5ec5a21b073c5cfe1 (diff) | |
| parent | 28a0facc9d45f0d1a0f03f00ad5f0e822fd9419e (diff) | |
Merge changes from topic 'exec-start-update-verifier'
* changes:
init.rc: launch update_verifier with exec_start
init: add exec_start command
Diffstat (limited to 'init/builtins.cpp')
| -rw-r--r-- | init/builtins.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 5a67e5e1ef..02e314f64b 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -167,19 +167,11 @@ static int do_enable(const std::vector<std::string>& args) { } static int do_exec(const std::vector<std::string>& args) { - Service* svc = ServiceManager::GetInstance().MakeExecOneshotService(args); - if (!svc) { - return -1; - } - if (!start_waiting_for_exec()) { - return -1; - } - if (!svc->Start()) { - stop_waiting_for_exec(); - ServiceManager::GetInstance().RemoveService(*svc); - return -1; - } - return 0; + return ServiceManager::GetInstance().Exec(args) ? 0 : -1; +} + +static int do_exec_start(const std::vector<std::string>& args) { + return ServiceManager::GetInstance().ExecStart(args[1]) ? 0 : -1; } static int do_export(const std::vector<std::string>& args) { @@ -897,6 +889,7 @@ static int do_init_user0(const std::vector<std::string>& args) { BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { constexpr std::size_t kMax = std::numeric_limits<std::size_t>::max(); + // clang-format off static const Map builtin_functions = { {"bootchart", {1, 1, do_bootchart}}, {"chmod", {2, 2, do_chmod}}, @@ -909,6 +902,7 @@ BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { {"domainname", {1, 1, do_domainname}}, {"enable", {1, 1, do_enable}}, {"exec", {1, kMax, do_exec}}, + {"exec_start", {1, 1, do_exec_start}}, {"export", {2, 2, do_export}}, {"hostname", {1, 1, do_hostname}}, {"ifup", {1, 1, do_ifup}}, @@ -942,5 +936,6 @@ BuiltinFunctionMap::Map& BuiltinFunctionMap::map() const { {"wait_for_prop", {2, 2, do_wait_for_prop}}, {"write", {2, 2, do_write}}, }; + // clang-format on return builtin_functions; } |
