Fix context mapping for UST and kernel
[lttng-tools.git] / src / bin / lttng-sessiond / trace-ust.c
index 80644ac8330b438da015b7f149ff10cee002bb5b..0858f47d53b29ea598f94471b4271d029ba1a2bd 100644 (file)
@@ -289,6 +289,25 @@ struct ltt_ust_context *trace_ust_create_context(
                struct lttng_event_context *ctx)
 {
        struct ltt_ust_context *uctx;
+       enum lttng_ust_context_type utype;
+
+       switch (ctx->ctx) {
+       case LTTNG_EVENT_CONTEXT_VTID:
+               utype = LTTNG_UST_CONTEXT_VTID;
+               break;
+       case LTTNG_EVENT_CONTEXT_VPID:
+               utype = LTTNG_UST_CONTEXT_VPID;
+               break;
+       case LTTNG_EVENT_CONTEXT_PTHREAD_ID:
+               utype = LTTNG_UST_CONTEXT_PTHREAD_ID;
+               break;
+       case LTTNG_EVENT_CONTEXT_PROCNAME:
+               utype = LTTNG_UST_CONTEXT_PROCNAME;
+               break;
+       default:
+               ERR("Invalid UST context");
+               return NULL;
+       }
 
        uctx = zmalloc(sizeof(struct ltt_ust_context));
        if (uctx == NULL) {
@@ -296,7 +315,7 @@ struct ltt_ust_context *trace_ust_create_context(
                goto error;
        }
 
-       uctx->ctx.ctx = ctx->ctx;
+       uctx->ctx.ctx = utype;
        lttng_ht_node_init_ulong(&uctx->node, (unsigned long) uctx->ctx.ctx);
 
        return uctx;
This page took 0.023465 seconds and 4 git commands to generate.