summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdriana Kobylak <anoo@us.ibm.com>2017-05-04 14:06:18 -0500
committerAdriana Kobylak <anoo@us.ibm.com>2017-05-08 13:49:16 -0500
commit04d7c7d962ddce2fbe5fde49c104b7712cc58620 (patch)
tree39beb42bda85471dd968e8dee8bd9140bb1c71a3
parentc7a7c45fec58ff593aecce92699b9ee41823d48e (diff)
downloadphosphor-objmgr-04d7c7d962ddce2fbe5fde49c104b7712cc58620.tar.gz
phosphor-objmgr-04d7c7d962ddce2fbe5fde49c104b7712cc58620.zip
app: Add subtree-remove option
New mapper option to wait until a specified interface is not present in any of the subtrees of the specified namespace. Usage: mapper subtree-remove <NAMESPACE>:<INTERFACE> mapper subtree-remove /foo/namespace:bar.interface A future change could add an additional option to wait for interfaces to appear in a subtree of the specified path. Note that the subtree option will look for the interface in the subtree paths, not on the specified base namespace path. So in order to find an interface in /base/level1/level2, then the specified namespace path should be /base/level1/. Change-Id: I862310d819c505c59161adcce338041a08e1218c Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
-rw-r--r--libmapper/app.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libmapper/app.c b/libmapper/app.c
index 7efc08c..9713835 100644
--- a/libmapper/app.c
+++ b/libmapper/app.c
@@ -137,6 +137,19 @@ finish:
exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
}
+static int subtree_main(int argc, char *argv[])
+{
+ int r = 0;
+
+ if (argc != 3) {
+ fprintf(stderr, "Usage: %s subtree-remove "
+ "NAMESPACE:INTERFACE\n", argv[0]);
+ exit(EXIT_FAILURE);
+ }
+
+ exit(r < 0 ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
/* print out the distinct dbus service name for the input dbus path */
static int get_service_main(int argc, char *argv[])
{
@@ -178,6 +191,9 @@ int main(int argc, char *argv[])
"\nCOMMANDS:\n"
" call invoke the specified method\n"
" wait wait for the specified objects to appear on the DBus\n"
+ " subtree-remove\n"
+ " wait until the specified interface is not present\n"
+ " in any of the subtrees of the specified namespace\n"
" get-service return the service identifier for input path\n";
if(argc < 2) {
@@ -189,6 +205,8 @@ int main(int argc, char *argv[])
call_main(argc, argv);
if(!strcmp(argv[1], "wait"))
wait_main(argc, argv);
+ if(!strcmp(argv[1], "subtree-remove"))
+ subtree_main(argc, argv);
if(!strcmp(argv[1], "get-service"))
get_service_main(argc, argv);
OpenPOWER on IntegriCloud