X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=libust%2Ftracectl.c;h=a82c107c24364e35bfde21413215c412402cad76;hb=b9318b35947bbd6d3b2998b28d974c5e5bfabcf6;hp=03220373c92dee9c7eea7ee259d231de8924b809;hpb=4267e589be114e837b06ad0b40fc58cdf7ea080a;p=ust.git diff --git a/libust/tracectl.c b/libust/tracectl.c index 0322037..a82c107 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -788,6 +788,15 @@ static void listener_cleanup(void *ptr) ustcomm_fini_app(&ustcomm_app, 0); } +static void do_cmd_force_switch() +{ + struct blocked_consumer *bc; + + list_for_each_entry(bc, &blocked_consumers, list) { + ltt_force_switch(bc->buf, FORCE_FLUSH); + } +} + int process_client_cmd(char *recvbuf, struct ustcomm_source *src) { int result; @@ -994,6 +1003,28 @@ int process_client_cmd(char *recvbuf, struct ustcomm_source *src) free(reply); } + else if(nth_token_is(recvbuf, "get_sock_path", 0) == 1) { + char *reply = getenv("UST_DAEMON_SOCKET"); + if(!reply) { + asprintf(&reply, "%s/%s", SOCK_DIR, "ustd"); + result = ustcomm_send_reply(&ustcomm_app.server, reply, src); + free(reply); + } + else { + result = ustcomm_send_reply(&ustcomm_app.server, reply, src); + } + if(result) + ERR("ustcomm_send_reply failed"); + } + else if(nth_token_is(recvbuf, "set_sock_path", 0) == 1) { + char *sock_path = nth_token(recvbuf, 1); + result = setenv("UST_DAEMON_SOCKET", sock_path, 1); + if(result) + ERR("cannot set UST_DAEMON_SOCKET environment variable"); + } + else if(nth_token_is(recvbuf, "force_switch", 0) == 1) { + do_cmd_force_switch(); + } else { ERR("unable to parse message: %s", recvbuf); }