summaryrefslogtreecommitdiff
path: root/unit.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-15 23:16:16 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-15 23:16:16 +0200
commit05e343b70453716cc6292b17e7ef175a8c106aad (patch)
tree69046ed39bba96164cf4e2a157b3dcc5a6d415f6 /unit.c
parent4f2d528d3bb25cebf8d3ebe83d8193ab4016cb90 (diff)
service: optionally, trie dbus name cycle to service cycle
Diffstat (limited to 'unit.c')
-rw-r--r--unit.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/unit.c b/unit.c
index 872abf3e13..900c76ad66 100644
--- a/unit.c
+++ b/unit.c
@@ -1023,6 +1023,9 @@ int unit_watch_pid(Unit *u, pid_t pid) {
assert(u);
assert(pid >= 1);
+ /* Watch a specific PID. We only support one unit watching
+ * each PID for now. */
+
return hashmap_put(u->meta.manager->watch_pids, UINT32_TO_PTR(pid), u);
}
@@ -1030,7 +1033,7 @@ void unit_unwatch_pid(Unit *u, pid_t pid) {
assert(u);
assert(pid >= 1);
- hashmap_remove(u->meta.manager->watch_pids, UINT32_TO_PTR(pid));
+ hashmap_remove_value(u->meta.manager->watch_pids, UINT32_TO_PTR(pid), u);
}
int unit_watch_timer(Unit *u, usec_t delay, Watch *w) {
@@ -1606,6 +1609,23 @@ fail:
return NULL;
}
+int unit_watch_bus_name(Unit *u, const char *name) {
+ assert(u);
+ assert(name);
+
+ /* Watch a specific name on the bus. We only support one unit
+ * watching each name for now. */
+
+ return hashmap_put(u->meta.manager->watch_bus, name, u);
+}
+
+void unit_unwatch_bus_name(Unit *u, const char *name) {
+ assert(u);
+ assert(name);
+
+ hashmap_remove_value(u->meta.manager->watch_bus, name, u);
+}
+
static const char* const unit_type_table[_UNIT_TYPE_MAX] = {
[UNIT_SERVICE] = "service",
[UNIT_TIMER] = "timer",