Fix: add-context cannot be performed after a session has been started
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index 297db20ce062201630bd96ab91f268b79897916b..726c4e388c7a01669b068bc30d7de4f647a26549 100644 (file)
@@ -1270,6 +1270,7 @@ restart:
        if (!cmd_socket_wrapper) {
                goto error;
        }
+       cmd_socket_wrapper->lock = &consumer_data->lock;
 
        ret = consumer_send_channel_monitor_pipe(cmd_socket_wrapper,
                        consumer_data->channel_monitor_pipe);
@@ -1445,7 +1446,17 @@ error_poll:
 }
 
 /*
- * This thread manage application communication.
+ * This thread receives application command sockets (FDs) on the
+ * apps_cmd_pipe and waits (polls) on them until they are closed
+ * or an error occurs.
+ *
+ * At that point, it flushes the data (tracing and metadata) associated
+ * with this application and tears down ust app sessions and other
+ * associated data structures through ust_app_unregister().
+ *
+ * Note that this thread never sends commands to the applications
+ * through the command sockets; it merely listens for hang-ups
+ * and errors on those sockets and cleans-up as they occur.
  */
 static void *thread_manage_apps(void *data)
 {
@@ -2440,11 +2451,10 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                        break;
                case LTTNG_CONSUMER64_UST:
                {
-                       char *tmpnew = NULL;
-
                        if (config.consumerd64_lib_dir.value) {
                                char *tmp;
                                size_t tmplen;
+                               char *tmpnew;
 
                                tmp = lttng_secure_getenv("LD_LIBRARY_PATH");
                                if (!tmp) {
@@ -2462,9 +2472,9 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                        strcat(tmpnew, tmp);
                                }
                                ret = setenv("LD_LIBRARY_PATH", tmpnew, 1);
+                               free(tmpnew);
                                if (ret) {
                                        ret = -errno;
-                                       free(tmpnew);
                                        goto error;
                                }
                        }
@@ -2474,16 +2484,14 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                        "--consumerd-err-sock", consumer_data->err_unix_sock_path,
                                        "--group", config.tracing_group_name.value,
                                        NULL);
-                       free(tmpnew);
                        break;
                }
                case LTTNG_CONSUMER32_UST:
                {
-                       char *tmpnew = NULL;
-
                        if (config.consumerd32_lib_dir.value) {
                                char *tmp;
                                size_t tmplen;
+                               char *tmpnew;
 
                                tmp = lttng_secure_getenv("LD_LIBRARY_PATH");
                                if (!tmp) {
@@ -2501,9 +2509,9 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                        strcat(tmpnew, tmp);
                                }
                                ret = setenv("LD_LIBRARY_PATH", tmpnew, 1);
+                               free(tmpnew);
                                if (ret) {
                                        ret = -errno;
-                                       free(tmpnew);
                                        goto error;
                                }
                        }
@@ -2513,7 +2521,6 @@ static pid_t spawn_consumerd(struct consumer_data *consumer_data)
                                        "--consumerd-err-sock", consumer_data->err_unix_sock_path,
                                        "--group", config.tracing_group_name.value,
                                        NULL);
-                       free(tmpnew);
                        break;
                }
                default:
This page took 0.024934 seconds and 4 git commands to generate.