summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-09-07 13:32:21 -0700
committerMichael Bestas <mikeioannina@gmail.com>2015-11-11 19:54:39 +0200
commit6bb47701a9326bbaf6edb97867ada5b012451048 (patch)
treeb7b7a62b558052a778b20878849042f609318e42
parent91b5dfbc15feb36935b4ab07bb9a2a19dd24bfd1 (diff)
downloadsystem_core-6bb47701a9326bbaf6edb97867ada5b012451048.zip
system_core-6bb47701a9326bbaf6edb97867ada5b012451048.tar.gz
system_core-6bb47701a9326bbaf6edb97867ada5b012451048.tar.bz2
init: Fire a trigger when a class is started/stopped
* This allows us to react to these events without messing with the master config. Change-Id: Ifc72efc7b4cc0718838c711395f5fdc3b043827a
-rw-r--r--init/builtins.cpp20
1 files changed, 16 insertions, 4 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 9901786..e3e64f4 100644
--- a/init/builtins.cpp
+++ b/init/builtins.cpp
@@ -111,23 +111,35 @@ static void service_start_if_not_disabled(struct service *svc)
int do_class_start(int nargs, char **args)
{
- /* Starting a class does not start services
- * which are explicitly disabled. They must
- * be started individually.
- */
+ char prop[PROP_NAME_MAX];
+ snprintf(prop, PROP_NAME_MAX, "class_start:%s", args[1]);
+
+ /* Starting a class does not start services
+ * which are explicitly disabled. They must
+ * be started individually.
+ */
service_for_each_class(args[1], service_start_if_not_disabled);
+ action_for_each_trigger(prop, action_add_queue_tail);
return 0;
}
int do_class_stop(int nargs, char **args)
{
+ char prop[PROP_NAME_MAX];
+ snprintf(prop, PROP_NAME_MAX, "class_stop:%s", args[1]);
+
service_for_each_class(args[1], service_stop);
+ action_for_each_trigger(prop, action_add_queue_tail);
return 0;
}
int do_class_reset(int nargs, char **args)
{
+ char prop[PROP_NAME_MAX];
+ snprintf(prop, PROP_NAME_MAX, "class_reset:%s", args[1]);
+
service_for_each_class(args[1], service_reset);
+ action_for_each_trigger(prop, action_add_queue_tail);
return 0;
}