X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=ltt-sessiond%2Ftraceable-app.c;h=653d86b3fe3cbf675d25428a446b9be6b672e79a;hb=b3c750d2ffae77322752a5b4f43bd4ddae3dfea6;hp=85d50393a6b9eaaa60eeb17bb963370656d9708a;hpb=f8f0c3d1337c4eda5fb76a323ffe6c21c926a21e;p=lttng-tools.git diff --git a/ltt-sessiond/traceable-app.c b/ltt-sessiond/traceable-app.c index 85d50393a..653d86b3f 100644 --- a/ltt-sessiond/traceable-app.c +++ b/ltt-sessiond/traceable-app.c @@ -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, <t_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();