Fix: event probes attached before event enabled
[lttng-ust.git] / liblttng-ust / lttng-events.c
index 855f8d8739d1ff0ecb07d6779957c4f11153f9db..75e48a3c823b80a9e38b4a842e9d7471828b427f 100644 (file)
@@ -766,8 +766,10 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
                        head = &session->events_ht.table[hash & (LTTNG_UST_EVENT_HT_SIZE - 1)];
                        cds_hlist_for_each_entry(event, node, head, hlist) {
                                if (event->desc == desc
-                                               && event->chan == enabler->chan)
+                                               && event->chan == enabler->chan) {
                                        found = 1;
+                                       break;
+                               }
                        }
                        if (found)
                                continue;
@@ -901,6 +903,9 @@ int lttng_enabler_ref_events(struct lttng_enabler *enabler)
        struct lttng_session *session = enabler->chan->session;
        struct lttng_event *event;
 
+       if (!enabler->enabled)
+               goto end;
+
        /* First ensure that probe events are created for this enabler. */
        lttng_create_event_if_missing(enabler);
 
@@ -932,6 +937,7 @@ int lttng_enabler_ref_events(struct lttng_enabler *enabler)
 
                /* TODO: merge event context. */
        }
+end:
        return 0;
 }
 
@@ -1126,6 +1132,18 @@ int lttng_attach_context(struct lttng_ust_context *context_param,
                return lttng_add_user_ns_to_ctx(ctx);
        case LTTNG_UST_CONTEXT_UTS_NS:
                return lttng_add_uts_ns_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_VUID:
+               return lttng_add_vuid_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_VEUID:
+               return lttng_add_veuid_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_VSUID:
+               return lttng_add_vsuid_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_VGID:
+               return lttng_add_vgid_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_VEGID:
+               return lttng_add_vegid_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_VSGID:
+               return lttng_add_vsgid_to_ctx(ctx);
        default:
                return -EINVAL;
        }
This page took 0.024981 seconds and 4 git commands to generate.