Cleanup: ust-tracepoint-event.h: extract `__num_fields` in a variable
[lttng-ust.git] / liblttng-ust / lttng-events.c
index e130ec626d35f3f6d140737d51151245acbc51a6..9b2d3c649ac1b695e8d1136af11e12797b5053bc 100644 (file)
@@ -415,6 +415,9 @@ int lttng_session_enable(struct lttng_session *session)
        /* Set transient enabler state to "enabled" */
        session->tstate = 1;
 
+       /* We need to sync enablers with session before activation. */
+       lttng_session_sync_enablers(session);
+
        /*
         * Snapshot the number of events per channel to know the type of header
         * we need to use.
@@ -458,9 +461,6 @@ int lttng_session_enable(struct lttng_session *session)
                }
        }
 
-       /* We need to sync enablers with session before activation. */
-       lttng_session_sync_enablers(session);
-
        /* Set atomically the state to "active" */
        CMM_ACCESS_ONCE(session->active) = 1;
        CMM_ACCESS_ONCE(session->been_active) = 1;
@@ -600,8 +600,6 @@ int lttng_event_create(const struct lttng_event_desc *desc,
                goto sessiond_register_error;
        }
 
-       /* Populate lttng_event structure before tracepoint registration. */
-       cmm_smp_wmb();
        cds_list_add(&event->node, &chan->session->events_head);
        cds_hlist_add_head(&event->hlist, head);
        return 0;
@@ -746,7 +744,8 @@ void lttng_create_event_if_missing(struct lttng_enabler *enabler)
         */
        cds_list_for_each_entry(probe_desc, probe_list, head) {
                for (i = 0; i < probe_desc->nr_events; i++) {
-                       int found = 0, ret;
+                       int ret;
+                       bool found = false;
                        struct cds_hlist_head *head;
                        struct cds_hlist_node *node;
                        const char *event_name;
@@ -766,8 +765,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)
-                                       found = 1;
+                                               && event->chan == enabler->chan) {
+                                       found = true;
+                                       break;
+                               }
                        }
                        if (found)
                                continue;
@@ -798,7 +799,7 @@ void lttng_probe_provider_unregister_events(struct lttng_probe_desc *provider_de
        struct lttng_session *session;
        struct cds_hlist_head *head;
        struct lttng_event *event;
-       int i;
+       unsigned int i, j;
 
        /* Get handle on list of sessions. */
        sessionsp = _lttng_get_sessions();
@@ -1112,6 +1113,32 @@ int lttng_attach_context(struct lttng_ust_context *context_param,
        case LTTNG_UST_CONTEXT_APP_CONTEXT:
                return lttng_ust_add_app_context_to_ctx_rcu(uargs->app_context.ctxname,
                        ctx);
+       case LTTNG_UST_CONTEXT_CGROUP_NS:
+               return lttng_add_cgroup_ns_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_IPC_NS:
+               return lttng_add_ipc_ns_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_MNT_NS:
+               return lttng_add_mnt_ns_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_NET_NS:
+               return lttng_add_net_ns_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_PID_NS:
+               return lttng_add_pid_ns_to_ctx(ctx);
+       case LTTNG_UST_CONTEXT_USER_NS:
+               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.023823 seconds and 4 git commands to generate.