+ process_channel_cmd(sock, recv_header->command, ch_inf);
+ return;
+ }
+ case GET_BUF_SHMID_PIPE_FD:
+ case NOTIFY_BUF_MAPPED:
+ case GET_SUBBUFFER:
+ case PUT_SUBBUFFER:
+ {
+ struct ustcomm_buffer_info *buf_inf;
+ buf_inf = (struct ustcomm_buffer_info *)recv_buf;
+ result = ustcomm_unpack_buffer_info(buf_inf);
+ if (result < 0) {
+ ERR("couldn't unpack buffer info");
+ reply_header->result = -EINVAL;
+ goto send_response;
+ }
+ process_buffer_cmd(sock, recv_header->command, buf_inf);
+ return;
+ }
+ case ENABLE_MARKER:
+ case DISABLE_MARKER:
+ {
+ struct ustcomm_marker_info *marker_inf;
+ marker_inf = (struct ustcomm_marker_info *)recv_buf;
+ result = ustcomm_unpack_marker_info(marker_inf);
+ if (result < 0) {
+ ERR("couldn't unpack marker info");
+ reply_header->result = -EINVAL;
+ goto send_response;
+ }
+ process_marker_cmd(sock, recv_header->command, marker_inf);
+ return;
+ }
+ case LIST_MARKERS:
+ {
+ char *ptr;
+ size_t size;
+ FILE *fp;
+
+ fp = open_memstream(&ptr, &size);
+ if (fp == NULL) {
+ ERR("opening memstream failed");
+ return;
+ }
+ print_markers(fp);
+ fclose(fp);
+
+ reply_header->size = size + 1; /* Include final \0 */
+
+ result = ustcomm_send(sock, reply_header, ptr);
+
+ free(ptr);
+
+ if (result < 0) {
+ PERROR("failed to send markers list");
+ }
+
+ break;
+ }
+ case LIST_TRACE_EVENTS:
+ {
+ char *ptr;
+ size_t size;
+ FILE *fp;
+
+ fp = open_memstream(&ptr, &size);
+ if (fp == NULL) {
+ ERR("opening memstream failed");
+ return;
+ }
+ print_trace_events(fp);
+ fclose(fp);
+
+ reply_header->size = size + 1; /* Include final \0 */
+
+ result = ustcomm_send(sock, reply_header, ptr);
+
+ free(ptr);
+
+ if (result < 0) {
+ ERR("list_trace_events failed");
+ return;
+ }
+
+ break;
+ }
+ case LOAD_PROBE_LIB:
+ {
+ char *libfile;
+
+ /* FIXME: No functionality at all... */
+ libfile = recv_buf;
+
+ DBG("load_probe_lib loading %s", libfile);
+
+ break;
+ }
+ case GET_PIDUNIQUE:
+ {
+ struct ustcomm_pidunique *pid_msg;
+ pid_msg = (struct ustcomm_pidunique *)send_buf;
+
+ pid_msg->pidunique = pidunique;
+ reply_header->size = sizeof(pid_msg);
+
+ goto send_response;
+
+ }
+ case GET_SOCK_PATH:
+ {
+ struct ustcomm_single_field *sock_msg;
+ char *sock_path_env;
+
+ sock_msg = (struct ustcomm_single_field *)send_buf;
+
+ sock_path_env = getenv("UST_DAEMON_SOCKET");
+
+ if (!sock_path_env) {
+ result = ustcomm_pack_single_field(reply_header,
+ sock_msg,
+ SOCK_DIR "/ustconsumer");