output the env associated with an instance
authorJohn Crispin <blogic@openwrt.org>
Tue, 3 Sep 2013 23:24:14 +0000 (01:24 +0200)
committerJohn Crispin <blogic@openwrt.org>
Fri, 13 Sep 2013 15:35:55 +0000 (17:35 +0200)
Signed-off-by: John Crispin <blogic@openwrt.org>
instance.c

index c25c85989bf2449178fedd15a2c99e954a2d39bd..90c167a4d634164c54bbbdcf9905f009e6bcca09 100644 (file)
@@ -434,6 +434,15 @@ void instance_dump(struct blob_buf *b, struct service_instance *in, int verbose)
        if (in->proc.pending)
                blobmsg_add_u32(b, "pid", in->proc.pid);
        blobmsg_add_blob(b, in->command);
+
+       if (!avl_is_empty(&in->env.avl)) {
+               struct blobmsg_list_node *var;
+               void *e = blobmsg_open_table(b, "env");
+               blobmsg_list_for_each(&in->env, var)
+                       blobmsg_add_string(b, blobmsg_name(var->data), blobmsg_data(var->data));
+               blobmsg_close_table(b, e);
+       }
+
        if (verbose && in->trigger)
                blobmsg_add_blob(b, in->trigger);
        if (!measure_process(in->proc.pid, &pi)) {