summaryrefslogtreecommitdiffstats
path: root/service.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-06-24 21:32:39 +0200
committerFelix Fietkau <nbd@openwrt.org>2012-06-24 21:32:39 +0200
commit2c6b282d4b4a22e511e8cced48263fd0bc9cc6da (patch)
tree8676f387bde84ac09326bc8960e537428349f714 /service.c
parentb17d66a55a8ed4124d98f8c80e7a3b7122650c5a (diff)
downloadunitd-2c6b282d4b4a22e511e8cced48263fd0bc9cc6da.tar
unitd-2c6b282d4b4a22e511e8cced48263fd0bc9cc6da.zip
dump status info
Diffstat (limited to 'service.c')
-rw-r--r--service.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/service.c b/service.c
index 46f846d..1f1b1a8 100644
--- a/service.c
+++ b/service.c
@@ -148,6 +148,20 @@ free:
return ret;
}
+static void
+service_dump(struct service *s)
+{
+ struct service_instance *in;
+ void *c, *i;
+
+ c = blobmsg_open_table(&b, s->name);
+ i = blobmsg_open_table(&b, "instances");
+ vlist_for_each_element(&s->instances, in, node)
+ instance_dump(&b, in);
+ blobmsg_close_table(&b, i);
+ blobmsg_close_table(&b, c);
+}
+
static int
service_handle_list(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -156,12 +170,8 @@ service_handle_list(struct ubus_context *ctx, struct ubus_object *obj,
struct service *s;
blob_buf_init(&b, 0);
- avl_for_each_element(&services, s, avl) {
- void *c;
-
- c = blobmsg_open_table(&b, s->name);
- blobmsg_close_table(&b, c);
- }
+ avl_for_each_element(&services, s, avl)
+ service_dump(s);
ubus_send_reply(ctx, req, b.head);