Fix enable-channel that did not handle correctly lttng domains
[lttng-tools.git] / ltt-sessiond / traceable-app.c
index 85d50393a6b9eaaa60eeb17bb963370656d9708a..653d86b3fe3cbf675d25428a446b9be6b672e79a 100644 (file)
@@ -98,6 +98,24 @@ static struct ltt_traceable_app *find_app_by_sock(int sock)
        return NULL;
 }
 
+/*
+ * Iterate over the traceable apps list and return a pointer or NULL if not
+ * found.
+ */
+struct ltt_traceable_app *traceable_app_get_by_pid(pid_t pid)
+{
+       struct ltt_traceable_app *iter;
+
+       cds_list_for_each_entry(iter, &ltt_traceable_app_list.head, list) {
+               if (iter->pid == pid) {
+                       /* Found */
+                       return iter;
+               }
+       }
+
+       return NULL;
+}
+
 /*
  * Using pid and uid (of the app), allocate a new ltt_traceable_app struct and
  * add it to the global traceable app list.
@@ -151,7 +169,6 @@ void unregister_traceable_app(int sock)
                DBG("PID %d unregistered with sock %d", lta->pid, sock);
                close(lta->sock);
                del_traceable_app(lta);
-               unlock_apps_list();
                free(lta);
        }
        unlock_apps_list();
This page took 0.024723 seconds and 4 git commands to generate.