+ pid_t *pids;
+ llm.num_pckt = ust_list_apps(&pids);
+ if (llm.num_pckt == 0) {
+ ret = LTTCOMM_NO_APPS;
+ goto error;
+ }
+
+ /* 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--;
+ }
+ /* Allocated array by ust_list_apps() */
+ free(pids);
+
+ break;
+ }
+ case LTTNG_LIST_SESSIONS:
+ {
+ struct ltt_session *iter = NULL;
+
+ llm.num_pckt = session_count;
+ if (llm.num_pckt == 0) {
+ ret = LTTCOMM_NO_SESS;
+ goto error;
+ }
+
+ cds_list_for_each_entry(iter, <t_session_list.head, list) {
+ uuid_unparse(iter->uuid, llm.u.list_sessions.uuid);
+ strncpy(llm.u.list_sessions.name, iter->name,
+ sizeof(llm.u.list_sessions.name));
+ ret = send_unix_sock(sock, (void*) &llm, sizeof(llm));
+ if (ret < 0) {
+ goto send_error;
+ }
+ llm.num_pckt--;
+ }
+