+ /*
+ * Look for the application in the local wait queue and set the
+ * notify socket if found.
+ */
+ cds_list_for_each_entry(wait_node, &wait_queue, head) {
+ if (wait_node->app->pid == ust_cmd->reg_msg.pid) {
+ wait_node->app->notify_sock = ust_cmd->sock;
+ cds_list_del(&wait_node->head);
+ app = wait_node->app;
+ free(wait_node);
+ DBG3("UST app notify socket %d is set", ust_cmd->sock);
+ break;
+ }
+ }
+ }
+
+ if (app) {
+ ret = send_app_sockets_to_threads(app);
+ if (ret < 0) {
+ goto error;
+ }
+ /*
+ * @session_lock_list
+ *
+ * Lock the global session list so from the register up to the
+ * registration done message, no thread can see the application
+ * and change its state.
+ */
+ session_lock_list();
+ rcu_read_lock();
+ /*
+ * Add application to the global hash table. This needs to be
+ * done before the update to the UST registry can locate the
+ * application.
+ */
+ ust_app_add(app);
+ /*
+ * Get app version.
+ */
+ ret = ust_app_version(app);
+ if (ret) {
+ ERR("Unable to get app version");
+ }
+ /*
+ * Update newly registered application with the tracing
+ * registry info already enabled information.
+ */
+ update_ust_app(app->sock);
+ ret = ust_app_register_done(app->sock);
+ if (ret < 0) {
+ /* Remove application from the registry. */
+ ust_app_unregister(app->sock);
+ }
+ rcu_read_unlock();
+ session_unlock_list();
+ } else {
+ /* Application manager threads are not available. */