Custom upgrade: refactor: ust_app_find_by_pid -> ust_app_with_pid_exists 2.13-custom-upgrade
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 6 Jun 2022 22:00:30 +0000 (18:00 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 30 Sep 2022 19:12:36 +0000 (15:12 -0400)
ust_app_find_by_pid is only used to check if apps should be updated. No
need to return a ust_app. When a ust_app will be necessary, multiple
ust_app objects could be returned.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Change-Id: Ic6d2ff9820591ca85021ce701982136424792a22

src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h

index b6e756cc6b9134a506558af00b872e7542aad3d1..b28e5317ecfdc04cd5baed595e9d29cf63279a58 100644 (file)
@@ -987,7 +987,6 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value(
        struct process_attr_tracker *tracker;
        int integral_value;
        enum process_attr_tracker_status status;
-       struct ust_app *app;
 
        /*
         * Convert process attribute tracker value to the integral
@@ -1067,10 +1066,7 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_add_value(
        /* Add session to application */
        switch (process_attr) {
        case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
-               app = ust_app_find_by_pid(integral_value);
-               if (app) {
-                       should_update_apps = true;
-               }
+               should_update_apps = ust_app_with_pid_exists(integral_value);
                break;
        default:
                should_update_apps = true;
@@ -1096,7 +1092,6 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
        struct process_attr_tracker *tracker;
        int integral_value;
        enum process_attr_tracker_status status;
-       struct ust_app *app;
 
        /*
         * Convert process attribute tracker value to the integral
@@ -1177,10 +1172,7 @@ enum lttng_error_code trace_ust_process_attr_tracker_inclusion_set_remove_value(
        /* Add session to application */
        switch (process_attr) {
        case LTTNG_PROCESS_ATTR_VIRTUAL_PROCESS_ID:
-               app = ust_app_find_by_pid(integral_value);
-               if (app) {
-                       should_update_apps = true;
-               }
+               should_update_apps = ust_app_with_pid_exists(integral_value);
                break;
        default:
                should_update_apps = true;
index 409fb3590160e697b2384ebb3b378efed1659c1f..e180bff2abe45db514504c2c22a5a7b34a15d2a9 100644 (file)
@@ -3910,28 +3910,25 @@ error:
 }
 
 /*
- * Return ust app pointer or NULL if not found. RCU read side lock MUST be
+ * Check if a ust_app with a given pid is present. RCU read side lock MUST be
  * acquired before calling this function.
  */
-struct ust_app *ust_app_find_by_pid(pid_t pid)
+bool ust_app_with_pid_exists(pid_t pid)
 {
-       struct ust_app *app = NULL;
        struct lttng_ht_node_ulong *node;
        struct lttng_ht_iter iter;
+       bool present = false;
 
        lttng_ht_lookup(ust_app_ht, (void *)((unsigned long) pid), &iter);
        node = lttng_ht_iter_get_node_ulong(&iter);
        if (node == NULL) {
-               DBG2("UST app no found with pid %d", pid);
-               goto error;
+               DBG2("UST app not found with pid %d", pid);
+               goto end;
        }
 
-       DBG2("Found UST app by pid %d", pid);
-
-       app = caa_container_of(node, struct ust_app, pid_n);
-
-error:
-       return app;
+       present = true;
+end:
+       return present;
 }
 
 /*
index 4a7a7c92dfe72e62d312652d596302689ca63003..7bdc809881c61c65c19ab9992fd3e81d68b28439 100644 (file)
@@ -362,7 +362,7 @@ void ust_app_global_update_all_event_notifier_rules(void);
 
 void ust_app_clean_list(void);
 int ust_app_ht_alloc(void);
-struct ust_app *ust_app_find_by_pid(pid_t pid);
+bool ust_app_with_pid_exists(pid_t pid);
 struct ust_app_stream *ust_app_alloc_stream(void);
 int ust_app_recv_registration(int sock, struct ust_register_msg *msg);
 int ust_app_recv_notify(int sock);
@@ -614,9 +614,9 @@ struct ust_app *ust_app_find_by_sock(int sock)
        return NULL;
 }
 static inline
-struct ust_app *ust_app_find_by_pid(pid_t pid)
+bool ust_app_with_pid_exists(pid_t pid)
 {
-       return NULL;
+       return false;
 }
 static inline
 uint64_t ust_app_get_size_one_more_packet_per_stream(
This page took 0.032001 seconds and 5 git commands to generate.