+ reply_msg->channel = USTCOMM_POISON_PTR;
+ reply_msg->subbuf_num = num;
+ reply_msg->subbuf_size = size;
+
+
+ reply_header->size = COMPUTE_MSG_SIZE(reply_msg, offset);
+
+ break;
+ case SET_SUBBUF_NUM:
+ reply_header->result = set_subbuf_num(trace_name,
+ ch_inf->channel,
+ ch_inf->subbuf_num);
+
+ break;
+ case SET_SUBBUF_SIZE:
+ reply_header->result = set_subbuf_size(trace_name,
+ ch_inf->channel,
+ ch_inf->subbuf_size);
+
+
+ break;
+ }
+ if (ustcomm_send(sock, reply_header, (char *)reply_msg) < 0) {
+ ERR("ustcomm_send failed");
+ }
+}
+
+static void process_buffer_cmd(int sock, int command,
+ struct ustcomm_buffer_info *buf_inf)
+{
+ struct ustcomm_header _reply_header;
+ struct ustcomm_header *reply_header = &_reply_header;
+ struct ustcomm_buffer_info *reply_msg =
+ (struct ustcomm_buffer_info *)send_buffer;
+ char trace_name[] = "auto";
+ int result, offset = 0, buf_shmid, buf_struct_shmid, buf_pipe_fd;
+ long consumed_old;
+
+ memset(reply_header, 0, sizeof(*reply_header));
+
+ switch (command) {
+ case GET_BUF_SHMID_PIPE_FD:
+ result = get_buffer_shmid_pipe_fd(trace_name, buf_inf->channel,
+ buf_inf->ch_cpu,
+ &buf_shmid,
+ &buf_struct_shmid,
+ &buf_pipe_fd);
+ if (result < 0) {
+ reply_header->result = result;
+ break;
+ }
+
+ reply_msg->channel = USTCOMM_POISON_PTR;
+ reply_msg->buf_shmid = buf_shmid;
+ reply_msg->buf_struct_shmid = buf_struct_shmid;
+
+ reply_header->size = COMPUTE_MSG_SIZE(reply_msg, offset);
+ reply_header->fd_included = 1;
+
+ if (ustcomm_send_fd(sock, reply_header, (char *)reply_msg,
+ &buf_pipe_fd) < 0) {
+ ERR("ustcomm_send failed");
+ }
+ return;
+
+ case NOTIFY_BUF_MAPPED:
+ reply_header->result =
+ notify_buffer_mapped(trace_name,
+ buf_inf->channel,
+ buf_inf->ch_cpu);
+ break;
+ case GET_SUBBUFFER:
+ result = get_subbuffer(trace_name, buf_inf->channel,
+ buf_inf->ch_cpu, &consumed_old);
+ if (result < 0) {
+ reply_header->result = result;
+ break;
+ }
+
+ reply_msg->channel = USTCOMM_POISON_PTR;
+ reply_msg->consumed_old = consumed_old;
+
+ reply_header->size = COMPUTE_MSG_SIZE(reply_msg, offset);
+
+ break;
+ case PUT_SUBBUFFER:
+ result = put_subbuffer(trace_name, buf_inf->channel,
+ buf_inf->ch_cpu,
+ buf_inf->consumed_old);
+ reply_header->result = result;
+
+ break;
+ }
+
+ if (ustcomm_send(sock, reply_header, (char *)reply_msg) < 0) {
+ ERR("ustcomm_send failed");
+ }
+
+}
+
+static void process_marker_cmd(int sock, int command,
+ struct ustcomm_marker_info *marker_inf)
+{
+ struct ustcomm_header _reply_header;
+ struct ustcomm_header *reply_header = &_reply_header;
+ int result;
+
+ memset(reply_header, 0, sizeof(*reply_header));
+
+ switch(command) {
+ case ENABLE_MARKER:
+
+ result = ltt_marker_connect(marker_inf->channel,
+ marker_inf->marker,
+ "default");
+ if (result < 0) {
+ WARN("could not enable marker; channel=%s,"
+ " name=%s",
+ marker_inf->channel,
+ marker_inf->marker);
+
+ }
+ break;
+ case DISABLE_MARKER:
+ result = ltt_marker_disconnect(marker_inf->channel,
+ marker_inf->marker,
+ "default");