+ result = ltt_trace_set_type(trace_name, trace_type);
+ if (result < 0) {
+ ERR("ltt_trace_set_type failed");
+ return -1;
+ }
+ } else if (!strcmp(recvbuf, "trace_start")) {
+ DBG("trace start");
+
+ result = ltt_trace_alloc(trace_name);
+ if (result < 0) {
+ ERR("ltt_trace_alloc failed");
+ return -1;
+ }
+ if (!result) {
+ inform_consumer_daemon(trace_name);
+ }
+
+ result = ltt_trace_start(trace_name);
+ if (result < 0) {
+ ERR("ltt_trace_start failed");
+ return -1;
+ }
+ } else if (!strcmp(recvbuf, "trace_stop")) {
+ DBG("trace stop");
+
+ result = ltt_trace_stop(trace_name);
+ if (result < 0) {
+ ERR("ltt_trace_stop failed");
+ return -1;
+ }
+ } else if (!strcmp(recvbuf, "trace_destroy")) {
+
+ DBG("trace destroy");
+
+ result = ltt_trace_destroy(trace_name, 0);
+ if (result < 0) {
+ ERR("ltt_trace_destroy failed");
+ return -1;
+ }
+ } else if (nth_token_is(recvbuf, "get_shmid", 0) == 1) {
+ do_cmd_get_shmid(recvbuf, src);
+ } else if (nth_token_is(recvbuf, "get_n_subbufs", 0) == 1) {
+ do_cmd_get_n_subbufs(recvbuf, src);
+ } else if (nth_token_is(recvbuf, "get_subbuf_size", 0) == 1) {
+ do_cmd_get_subbuf_size(recvbuf, src);
+ } else if (nth_token_is(recvbuf, "load_probe_lib", 0) == 1) {
+ char *libfile;
+
+ libfile = nth_token(recvbuf, 1);
+
+ DBG("load_probe_lib loading %s", libfile);
+
+ free(libfile);
+ } else if (nth_token_is(recvbuf, "get_subbuffer", 0) == 1) {
+ do_cmd_get_subbuffer(recvbuf, src);
+ } else if (nth_token_is(recvbuf, "put_subbuffer", 0) == 1) {
+ do_cmd_put_subbuffer(recvbuf, src);
+ } else if (nth_token_is(recvbuf, "set_subbuf_size", 0) == 1) {
+ do_cmd_set_subbuf_size(recvbuf, src);
+ } else if (nth_token_is(recvbuf, "set_subbuf_num", 0) == 1) {
+ do_cmd_set_subbuf_num(recvbuf, src);
+ } else if (nth_token_is(recvbuf, "enable_marker", 0) == 1) {
+ char *channel_slash_name = nth_token(recvbuf, 1);
+ char channel_name[256]="";
+ char marker_name[256]="";
+
+ result = sscanf(channel_slash_name, "%255[^/]/%255s", channel_name, marker_name);
+
+ if (channel_name == NULL || marker_name == NULL) {
+ WARN("invalid marker name");
+ goto next_cmd;
+ }
+
+ result = ltt_marker_connect(channel_name, marker_name, "default");
+ if (result < 0) {
+ WARN("could not enable marker; channel=%s, name=%s", channel_name, marker_name);
+ }
+ } else if (nth_token_is(recvbuf, "disable_marker", 0) == 1) {
+ char *channel_slash_name = nth_token(recvbuf, 1);
+ char *marker_name;
+ char *channel_name;
+
+ result = sscanf(channel_slash_name, "%a[^/]/%as", &channel_name, &marker_name);
+
+ if (channel_name == NULL || marker_name == NULL) {
+ WARN("invalid marker name");
+ goto next_cmd;
+ }
+
+ result = ltt_marker_disconnect(channel_name, marker_name, "default");
+ if (result < 0) {
+ WARN("could not disable marker; channel=%s, name=%s", channel_name, marker_name);
+ }
+ } else if (nth_token_is(recvbuf, "get_pidunique", 0) == 1) {
+ char *reply;
+
+ if (asprintf(&reply, "%lld", pidunique) < 0) {
+ ERR("process_client_cmd : asprintf failed (%lld)",
+ pidunique);
+ goto next_cmd;
+ }
+
+ result = ustcomm_send_reply(&ustcomm_app.server, reply, src);
+ if (result) {
+ ERR("listener: get_pidunique: ustcomm_send_reply failed");
+ goto next_cmd;
+ }
+
+ free(reply);
+ } else if (nth_token_is(recvbuf, "get_sock_path", 0) == 1) {
+ char *reply = getenv("UST_DAEMON_SOCKET");
+ if (!reply) {
+ if (asprintf(&reply, "%s/%s", SOCK_DIR, "ustd") < 0) {
+ ERR("process_client_cmd : asprintf failed (%s/ustd)",
+ SOCK_DIR);