- /* Send all packets */
- while (llm.num_pckt != 0) {
- llm.u.list_apps.pid = pids[traceable_app_count - llm.num_pckt];
- ret = send_unix_sock(sock, (void*) &llm, sizeof(llm));
- if (ret < 0) {
- goto send_error;
- }
- llm.num_pckt--;
+ /* Setup data buffer and details for transmission */
+ buf_size = setup_data_buffer(&send_buf,
+ sizeof(pid_t) * traceable_app_count, &llm);
+ if (buf_size < 0) {
+ ret = LTTCOMM_FATAL;
+ goto error;
+ }
+
+ get_list_apps(send_buf + sizeof(struct lttcomm_lttng_msg));
+
+ ret = send_unix_sock(sock, send_buf, buf_size);
+ if (ret < 0) {
+ goto send_error;
+ }
+
+ break;
+ }
+ case LTTNG_LIST_SESSIONS:
+ {
+ /* Stop right now if no session */
+ if (session_count == 0) {
+ ret = LTTCOMM_NO_SESS;
+ goto error;
+ }
+
+ /* Setup data buffer and details for transmission */
+ buf_size = setup_data_buffer(&send_buf,
+ (sizeof(struct lttng_session) * session_count), &llm);
+ if (buf_size < 0) {
+ ret = LTTCOMM_FATAL;
+ goto error;
+ }
+
+ get_list_sessions(send_buf + sizeof(struct lttcomm_lttng_msg));
+
+ ret = send_unix_sock(sock, send_buf, buf_size);
+ if (ret < 0) {
+ goto send_error;