Adding context to an event is no longer possible
authorDavid Goulet <dgoulet@efficios.com>
Tue, 20 Nov 2012 18:33:23 +0000 (13:33 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 22 Nov 2012 17:03:30 +0000 (12:03 -0500)
The UST tracer does not allow to add context to an event so we've
removed that.

It is completely removed from the lttng UI so it's not possible either
to add one to the kernel. The "event_name" of lttng_add_context is now
ignored.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
18 files changed:
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/cmd.h
src/bin/lttng-sessiond/context.c
src/bin/lttng-sessiond/context.h
src/bin/lttng-sessiond/kernel.c
src/bin/lttng-sessiond/kernel.h
src/bin/lttng-sessiond/main.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/trace-kernel.h
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/trace-ust.h
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h
src/bin/lttng/commands/add_context.c
src/common/sessiond-comm/sessiond-comm.h
src/lib/lttng-ctl/lttng-ctl.c
tests/tools/test_kernel_data_trace.c
tests/tools/test_ust_data_trace.c

index 041b3e1bda8ea5e5d4c678aa26f14d0b7d831e38..d58c53b66865bc0126dab3a26882d7c58d1ce41d 100644 (file)
@@ -1035,8 +1035,7 @@ error:
  * Command LTTNG_ADD_CONTEXT processed by the client thread.
  */
 int cmd_add_context(struct ltt_session *session, int domain,
-               char *channel_name, char *event_name, struct lttng_event_context *ctx,
-               int kwpipe)
+               char *channel_name, struct lttng_event_context *ctx, int kwpipe)
 {
        int ret;
 
@@ -1053,8 +1052,7 @@ int cmd_add_context(struct ltt_session *session, int domain,
                }
 
                /* Add kernel context to kernel tracer */
-               ret = context_kernel_add(session->kernel_session, ctx,
-                               event_name, channel_name);
+               ret = context_kernel_add(session->kernel_session, ctx, channel_name);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -1083,8 +1081,7 @@ int cmd_add_context(struct ltt_session *session, int domain,
                        free(attr);
                }
 
-
-               ret = context_ust_add(usess, domain, ctx, event_name, channel_name);
+               ret = context_ust_add(usess, domain, ctx, channel_name);
                if (ret != LTTNG_OK) {
                        goto error;
                }
index 20fc84a9300ffe7680fb7aa9f0d48d1b28b07a26..061cb1aefef37d29f4208a69d558c1494825b87c 100644 (file)
@@ -45,8 +45,7 @@ int cmd_disable_event(struct ltt_session *session, int domain,
 int cmd_disable_event_all(struct ltt_session *session, int domain,
                char *channel_name);
 int cmd_add_context(struct ltt_session *session, int domain,
-               char *channel_name, char *event_name, struct lttng_event_context *ctx,
-               int kwpipe);
+               char *channel_name, struct lttng_event_context *ctx, int kwpipe);
 int cmd_set_filter(struct ltt_session *session, int domain,
                char *channel_name, char *event_name,
                struct lttng_filter_bytecode *bytecode);
index 1bf3c67680ed9d1f568c5d8b2b6455fa9d33edff..74afd4e0cad5ff87d307de751672ad1ae86bad61 100644 (file)
 #include "ust-app.h"
 #include "trace-ust.h"
 
-/*
- * Add kernel context to an event of a specific channel.
- */
-static int add_kctx_to_event(struct lttng_kernel_context *kctx,
-               struct ltt_kernel_channel *kchan, char *event_name)
-{
-       int ret, found = 0;
-       struct ltt_kernel_event *kevent;
-
-       DBG("Add kernel context to event %s", event_name);
-
-       kevent = trace_kernel_get_event_by_name(event_name, kchan);
-       if (kevent != NULL) {
-               ret = kernel_add_event_context(kevent, kctx);
-               if (ret < 0) {
-                       goto error;
-               }
-               found = 1;
-       }
-
-       ret = found;
-
-error:
-       return ret;
-}
-
 /*
  * Add kernel context to all channel.
- *
- * If event_name is specified, add context to event instead.
  */
 static int add_kctx_all_channels(struct ltt_kernel_session *ksession,
-               struct lttng_kernel_context *kctx, char *event_name)
+               struct lttng_kernel_context *kctx)
 {
-       int ret, no_event = 0, found = 0;
+       int ret;
        struct ltt_kernel_channel *kchan;
 
-       if (strlen(event_name) == 0) {
-               no_event = 1;
-       }
-
-       DBG("Adding kernel context to all channels (event: %s)", event_name);
+       DBG("Adding kernel context to all channels");
 
        /* Go over all channels */
        cds_list_for_each_entry(kchan, &ksession->channel_list.head, list) {
-               if (no_event) {
-                       ret = kernel_add_channel_context(kchan, kctx);
-                       if (ret < 0) {
-                               ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
-                               goto error;
-                       }
-               } else {
-                       ret = add_kctx_to_event(kctx, kchan, event_name);
-                       if (ret < 0) {
-                               ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
-                               goto error;
-                       } else if (ret == 1) {
-                               /* Event found and context added */
-                               found = 1;
-                               break;
-                       }
+               ret = kernel_add_channel_context(kchan, kctx);
+               if (ret < 0) {
+                       ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
+                       goto error;
                }
        }
 
-       if (!found && !no_event) {
-               ret = LTTNG_ERR_NO_EVENT;
-               goto error;
-       }
-
        ret = LTTNG_OK;
 
 error:
@@ -107,40 +58,17 @@ error:
 
 /*
  * Add kernel context to a specific channel.
- *
- * If event_name is specified, add context to that event.
  */
 static int add_kctx_to_channel(struct lttng_kernel_context *kctx,
-               struct ltt_kernel_channel *kchan, char *event_name)
+               struct ltt_kernel_channel *kchan)
 {
-       int ret, no_event = 0, found = 0;
-
-       if (strlen(event_name) == 0) {
-               no_event = 1;
-       }
+       int ret;
 
-       DBG("Add kernel context to channel '%s', event '%s'",
-                       kchan->channel->name, event_name);
+       DBG("Add kernel context to channel '%s'", kchan->channel->name);
 
-       if (no_event) {
-               ret = kernel_add_channel_context(kchan, kctx);
-               if (ret < 0) {
-                       ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
-                       goto error;
-               }
-       } else {
-               ret = add_kctx_to_event(kctx, kchan, event_name);
-               if (ret < 0) {
-                       ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
-                       goto error;
-               } else if (ret == 1) {
-                       /* Event found and context added */
-                       found = 1;
-               }
-       }
-
-       if (!found && !no_event) {
-               ret = LTTNG_ERR_NO_EVENT;
+       ret = kernel_add_channel_context(kchan, kctx);
+       if (ret < 0) {
+               ret = LTTNG_ERR_KERN_CONTEXT_FAIL;
                goto error;
        }
 
@@ -200,64 +128,11 @@ error:
        return ret;
 }
 
-/*
- * Add UST context to event.
- */
-static int add_uctx_to_event(struct ltt_ust_session *usess, int domain,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
-               struct lttng_event_context *ctx)
-{
-       int ret;
-       struct ltt_ust_context *uctx;
-       struct lttng_ht_iter iter;
-       struct lttng_ht_node_ulong *uctx_node;
-
-       /* Create ltt UST context */
-       uctx = trace_ust_create_context(ctx);
-       if (uctx == NULL) {
-               /* Context values are invalid. */
-               ret = -EINVAL;
-               goto error;
-       }
-
-       switch (domain) {
-       case LTTNG_DOMAIN_UST:
-               ret = ust_app_add_ctx_event_glb(usess, uchan, uevent, uctx);
-               if (ret < 0) {
-                       goto error;
-               }
-               break;
-       default:
-               ret = -ENOSYS;
-               goto error;
-       }
-
-       /* Lookup context before adding it */
-       lttng_ht_lookup(uevent->ctx, (void *)((unsigned long)uctx->ctx.ctx), &iter);
-       uctx_node = lttng_ht_iter_get_node_ulong(&iter);
-       if (uctx_node != NULL) {
-               ret = -EEXIST;
-               goto error;
-       }
-
-       /* Add ltt UST context node to ltt UST event */
-       lttng_ht_add_unique_ulong(uevent->ctx, &uctx->node);
-
-       DBG("Context UST %d added to event %s", uctx->ctx.ctx, uevent->attr.name);
-
-       return 0;
-
-error:
-       free(uctx);
-       return ret;
-}
-
 /*
  * Add kernel context to tracer.
  */
 int context_kernel_add(struct ltt_kernel_session *ksession,
-               struct lttng_event_context *ctx, char *event_name,
-               char *channel_name)
+               struct lttng_event_context *ctx, char *channel_name)
 {
        int ret;
        struct ltt_kernel_channel *kchan;
@@ -309,7 +184,7 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
        kctx.u.perf_counter.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
 
        if (strlen(channel_name) == 0) {
-               ret = add_kctx_all_channels(ksession, &kctx, event_name);
+               ret = add_kctx_all_channels(ksession, &kctx);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -321,7 +196,7 @@ int context_kernel_add(struct ltt_kernel_session *ksession,
                        goto error;
                }
 
-               ret = add_kctx_to_channel(&kctx, kchan, event_name);
+               ret = add_kctx_to_channel(&kctx, kchan);
                if (ret != LTTNG_OK) {
                        goto error;
                }
@@ -337,14 +212,12 @@ error:
  * Add UST context to tracer.
  */
 int context_ust_add(struct ltt_ust_session *usess, int domain,
-               struct lttng_event_context *ctx, char *event_name,
-               char *channel_name)
+               struct lttng_event_context *ctx, char *channel_name)
 {
-       int ret = LTTNG_OK, have_event = 0;
+       int ret = LTTNG_OK;
        struct lttng_ht_iter iter;
        struct lttng_ht *chan_ht;
        struct ltt_ust_channel *uchan = NULL;
-       struct ltt_ust_event *uevent = NULL;
 
        /*
         * Define which channel's hashtable to use from the domain or quit if
@@ -364,11 +237,6 @@ int context_ust_add(struct ltt_ust_session *usess, int domain,
                goto error;
        }
 
-       /* Do we have an event name */
-       if (strlen(event_name) != 0) {
-               have_event = 1;
-       }
-
        /* Get UST channel if defined */
        if (strlen(channel_name) != 0) {
                uchan = trace_ust_find_channel_by_name(chan_ht, channel_name);
@@ -378,39 +246,11 @@ int context_ust_add(struct ltt_ust_session *usess, int domain,
                }
        }
 
-       /* If UST channel specified and event name, get UST event ref */
-       if (uchan && have_event) {
-               uevent = trace_ust_find_event_by_name(uchan->events, event_name);
-               if (uevent == NULL) {
-                       ret = LTTNG_ERR_UST_EVENT_NOT_FOUND;
-                       goto error;
-               }
-       }
-
-       /* At this point, we have 4 possibilities */
-
-       if (uchan && uevent) {                          /* Add ctx to event in channel */
-               ret = add_uctx_to_event(usess, domain, uchan, uevent, ctx);
-       } else if (uchan && !have_event) {      /* Add ctx to channel */
+       if (uchan) {
+               /* Add ctx to channel */
                ret = add_uctx_to_channel(usess, domain, uchan, ctx);
-       } else if (!uchan && have_event) {      /* Add ctx to event */
-               /* Add context to event without having the channel name */
-               cds_lfht_for_each_entry(chan_ht->ht, &iter.iter, uchan, node.node) {
-                       uevent = trace_ust_find_event_by_name(uchan->events, event_name);
-                       if (uevent != NULL) {
-                               ret = add_uctx_to_event(usess, domain, uchan, uevent, ctx);
-                               /*
-                                * LTTng UST does not allowed the same event to be registered
-                                * multiple time in different or the same channel. So, if we
-                                * found our event, we stop.
-                                */
-                               goto end;
-                       }
-               }
-               ret = LTTNG_ERR_UST_EVENT_NOT_FOUND;
-               goto error;
-       } else if (!uchan && !have_event) {     /* Add ctx all events, all channels */
-               /* For all channels */
+       } else {
+               /* Add ctx all events, all channels */
                cds_lfht_for_each_entry(chan_ht->ht, &iter.iter, uchan, node.node) {
                        ret = add_uctx_to_channel(usess, domain, uchan, ctx);
                        if (ret < 0) {
@@ -420,7 +260,6 @@ int context_ust_add(struct ltt_ust_session *usess, int domain,
                }
        }
 
-end:
        switch (ret) {
        case -EEXIST:
                ret = LTTNG_ERR_UST_CONTEXT_EXIST;
index 83c3c83100cbb2786c49fd226ff3c9b4ff53d01e..e3047761b7d06251939183bcc3cb2c4b9fbae775 100644 (file)
@@ -25,9 +25,8 @@
 #include "ust-ctl.h"
 
 int context_kernel_add(struct ltt_kernel_session *ksession,
-               struct lttng_event_context *ctx, char *event_name, char *channel_name);
+               struct lttng_event_context *ctx, char *channel_name);
 int context_ust_add(struct ltt_ust_session *usess, int domain,
-               struct lttng_event_context *ctx, char *event_name,
-               char *channel_name);
+               struct lttng_event_context *ctx, char *channel_name);
 
 #endif /* _LTT_CONTEXT_H */
index bf03dbad985388a2355dcb2a46b3ad7281c9fccf..00172e80170c3089a9160bcd49ce8d72357107c0 100644 (file)
@@ -66,35 +66,6 @@ error:
        return ret;
 }
 
-/*
- * Add context on a kernel event.
- */
-int kernel_add_event_context(struct ltt_kernel_event *event,
-               struct lttng_kernel_context *ctx)
-{
-       int ret;
-
-       DBG("Adding context to event %s", event->event->name);
-       ret = kernctl_add_context(event->fd, ctx);
-       if (ret < 0) {
-               PERROR("add context ioctl");
-               goto error;
-       }
-
-       event->ctx = zmalloc(sizeof(struct lttng_kernel_context));
-       if (event->ctx == NULL) {
-               PERROR("zmalloc event context");
-               goto error;
-       }
-
-       memcpy(event->ctx, ctx, sizeof(struct lttng_kernel_context));
-
-       return 0;
-
-error:
-       return ret;
-}
-
 /*
  * Create a new kernel session, register it to the kernel tracer and add it to
  * the session daemon session.
index 35f7368d14773d4ed5430115792ee4196d7404a4..86ae00371bdc4790d1bd82fa15ad112e15468322 100644 (file)
@@ -32,8 +32,6 @@
 
 int kernel_add_channel_context(struct ltt_kernel_channel *chan,
                struct lttng_kernel_context *ctx);
-int kernel_add_event_context(struct ltt_kernel_event *event,
-               struct lttng_kernel_context *ctx);
 int kernel_create_session(struct ltt_session *session, int tracer_fd);
 int kernel_create_channel(struct ltt_kernel_session *session,
                struct lttng_channel *chan, char *path);
index 19eaa47d88b1fe38cdc6a56313aac7438f153f8f..7dd652abc38b62994d9ed9c1c9df8a663fedabca 100644 (file)
@@ -2462,7 +2462,6 @@ skip_domain:
        {
                ret = cmd_add_context(cmd_ctx->session, cmd_ctx->lsm->domain.type,
                                cmd_ctx->lsm->u.context.channel_name,
-                               cmd_ctx->lsm->u.context.event_name,
                                &cmd_ctx->lsm->u.context.ctx, kernel_poll_pipe[1]);
                break;
        }
index 4d2870addacbcb515e0fe1a8042752c2d5fb158f..e8c381aa8cbfd634a34788db30e2520a2a535a53 100644 (file)
@@ -243,7 +243,6 @@ struct ltt_kernel_event *trace_kernel_create_event(struct lttng_event *ev)
        lke->fd = -1;
        lke->event = attr;
        lke->enabled = 1;
-       lke->ctx = NULL;
 
        return lke;
 
@@ -369,7 +368,6 @@ void trace_kernel_destroy_event(struct ltt_kernel_event *event)
        cds_list_del(&event->list);
 
        free(event->event);
-       free(event->ctx);
        free(event);
 }
 
index ed5b3318921248250f135806e8450f3bf040f790..27baa6d3954bfecc1f03145909e73c5ee72dc480 100644 (file)
@@ -46,11 +46,6 @@ struct ltt_kernel_channel_list {
 struct ltt_kernel_event {
        int fd;
        int enabled;
-       /*
-        * TODO: need internal representation to support more than a
-        * single context.
-        */
-       struct lttng_kernel_context *ctx;
        struct lttng_kernel_event *event;
        struct cds_list_head list;
 };
index 2dcc7c25d95f737c2da19f88e6406b6c23d591c7..4c7dac8b72111f33904e7fef69a53e77578171cb 100644 (file)
@@ -274,12 +274,6 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev)
 
        /* Init node */
        lttng_ht_node_init_str(&lue->node, lue->attr.name);
-       /* Alloc context hash tables */
-       lue->ctx = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
-       if (lue->ctx == NULL) {
-               ERR("Unable to create context hash table for event %s", ev->name);
-               goto error_free_event;
-       }
 
        DBG2("Trace UST event %s, loglevel (%d,%d) created",
                lue->attr.name, lue->attr.loglevel_type,
@@ -415,7 +409,6 @@ static void destroy_contexts(struct lttng_ht *ht)
 void trace_ust_destroy_event(struct ltt_ust_event *event)
 {
        DBG2("Trace destroy UST event %s", event->attr.name);
-       destroy_contexts(event->ctx);
        free(event->filter);
        free(event);
 }
index b0a65cf191c5b9624d24e354b98d900c373ef7fe..297037b200d35d40c6d349a440d73b8c9ea3342f 100644 (file)
@@ -45,7 +45,6 @@ struct ltt_ust_context {
 struct ltt_ust_event {
        unsigned int enabled;
        struct lttng_ust_event attr;
-       struct lttng_ht *ctx;
        struct lttng_ht_node_str node;
        struct lttng_ust_filter_bytecode *filter;
 };
index 2c42eb5368504e9c827750dae6f9c15140566728..8dd7a9d1c8d43a64e03f891871ce7ae98b773140 100644 (file)
@@ -57,19 +57,7 @@ void delete_ust_app_ctx(int sock, struct ust_app_ctx *ua_ctx)
 static
 void delete_ust_app_event(int sock, struct ust_app_event *ua_event)
 {
-       int ret;
-       struct lttng_ht_iter iter;
-       struct ust_app_ctx *ua_ctx;
-
-       /* Destroy each context of event */
-       cds_lfht_for_each_entry(ua_event->ctx->ht, &iter.iter, ua_ctx,
-                       node.node) {
-               ret = lttng_ht_del(ua_event->ctx, &iter);
-               assert(!ret);
-               delete_ust_app_ctx(sock, ua_ctx);
-       }
        free(ua_event->filter);
-       lttng_ht_destroy(ua_event->ctx);
 
        if (ua_event->obj != NULL) {
                ustctl_release_object(sock, ua_event->obj);
@@ -326,7 +314,6 @@ struct ust_app_event *alloc_ust_app_event(char *name,
        ua_event->enabled = 1;
        strncpy(ua_event->name, name, sizeof(ua_event->name));
        ua_event->name[sizeof(ua_event->name) - 1] = '\0';
-       ua_event->ctx = lttng_ht_new(0, LTTNG_HT_TYPE_ULONG);
        lttng_ht_node_init_str(&ua_event->node, ua_event->name);
 
        /* Copy attributes */
@@ -414,32 +401,6 @@ error:
        return ret;
 }
 
-/*
- * Create the event context on the tracer.
- */
-static
-int create_ust_event_context(struct ust_app_event *ua_event,
-               struct ust_app_ctx *ua_ctx, struct ust_app *app)
-{
-       int ret;
-
-       health_code_update(&health_thread_cmd);
-
-       ret = ustctl_add_context(app->sock, &ua_ctx->ctx,
-                       ua_event->obj, &ua_ctx->obj);
-       if (ret < 0) {
-               goto error;
-       }
-
-       ua_ctx->handle = ua_ctx->obj->handle;
-
-       DBG2("UST app context created successfully for event %s", ua_event->name);
-
-error:
-       health_code_update(&health_thread_cmd);
-       return ret;
-}
-
 /*
  * Set the filter on the tracer.
  */
@@ -759,10 +720,6 @@ error:
 static void shadow_copy_event(struct ust_app_event *ua_event,
                struct ltt_ust_event *uevent)
 {
-       struct lttng_ht_iter iter;
-       struct ltt_ust_context *uctx;
-       struct ust_app_ctx *ua_ctx;
-
        strncpy(ua_event->name, uevent->attr.name, sizeof(ua_event->name));
        ua_event->name[sizeof(ua_event->name) - 1] = '\0';
 
@@ -781,17 +738,6 @@ static void shadow_copy_event(struct ust_app_event *ua_event,
                memcpy(ua_event->filter, uevent->filter,
                        sizeof(*ua_event->filter) + uevent->filter->len);
        }
-       cds_lfht_for_each_entry(uevent->ctx->ht, &iter.iter, uctx, node.node) {
-               ua_ctx = alloc_ust_app_ctx(&uctx->ctx);
-               if (ua_ctx == NULL) {
-                       /* malloc() failed. We should simply stop */
-                       return;
-               }
-
-               lttng_ht_node_init_ulong(&ua_ctx->node,
-                               (unsigned long) ua_ctx->ctx.ctx);
-               lttng_ht_add_unique_ulong(ua_event->ctx, &ua_ctx->node);
-       }
 }
 
 /*
@@ -1034,47 +980,6 @@ error:
        return ret;
 }
 
-/*
- * Create an UST context and enable it for the event on the tracer.
- */
-static
-int create_ust_app_event_context(struct ust_app_session *ua_sess,
-               struct ust_app_event *ua_event, struct lttng_ust_context *uctx,
-               struct ust_app *app)
-{
-       int ret = 0;
-       struct lttng_ht_iter iter;
-       struct lttng_ht_node_ulong *node;
-       struct ust_app_ctx *ua_ctx;
-
-       DBG2("UST app adding context to event %s", ua_event->name);
-
-       lttng_ht_lookup(ua_event->ctx, (void *)((unsigned long)uctx->ctx), &iter);
-       node = lttng_ht_iter_get_node_ulong(&iter);
-       if (node != NULL) {
-               ret = -EEXIST;
-               goto error;
-       }
-
-       ua_ctx = alloc_ust_app_ctx(uctx);
-       if (ua_ctx == NULL) {
-               /* malloc failed */
-               ret = -1;
-               goto error;
-       }
-
-       lttng_ht_node_init_ulong(&ua_ctx->node, (unsigned long) ua_ctx->ctx.ctx);
-       lttng_ht_add_unique_ulong(ua_event->ctx, &ua_ctx->node);
-
-       ret = create_ust_event_context(ua_event, ua_ctx, app);
-       if (ret < 0) {
-               goto error;
-       }
-
-error:
-       return ret;
-}
-
 /*
  * Set UST filter for the event on the tracer.
  */
@@ -2599,15 +2504,6 @@ void ust_app_global_update(struct ltt_ust_session *usess, int sock)
                                continue;
                        }
 
-                       /* Add context on events. */
-                       cds_lfht_for_each_entry(ua_event->ctx->ht, &iter_ctx.iter,
-                                       ua_ctx, node.node) {
-                               ret = create_ust_event_context(ua_event, ua_ctx, app);
-                               if (ret < 0) {
-                                       /* FIXME: Should we quit here or continue... */
-                                       continue;
-                               }
-                       }
                        ret = set_ust_event_filter(ua_event, app);
                        if (ret < 0) {
                                /* FIXME: Should we quit here or continue... */
@@ -2677,63 +2573,6 @@ int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
        return ret;
 }
 
-/*
- * Add context to a specific event in a channel for global UST domain.
- */
-int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
-               struct ltt_ust_context *uctx)
-{
-       int ret = 0;
-       struct lttng_ht_node_str *ua_chan_node, *ua_event_node;
-       struct lttng_ht_iter iter, uiter;
-       struct ust_app_session *ua_sess;
-       struct ust_app_event *ua_event;
-       struct ust_app_channel *ua_chan = NULL;
-       struct ust_app *app;
-
-       rcu_read_lock();
-
-       cds_lfht_for_each_entry(ust_app_ht->ht, &iter.iter, app, pid_n.node) {
-               if (!app->compatible) {
-                       /*
-                        * TODO: In time, we should notice the caller of this error by
-                        * telling him that this is a version error.
-                        */
-                       continue;
-               }
-               ua_sess = lookup_session_by_app(usess, app);
-               if (ua_sess == NULL) {
-                       continue;
-               }
-
-               /* Lookup channel in the ust app session */
-               lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &uiter);
-               ua_chan_node = lttng_ht_iter_get_node_str(&uiter);
-               if (ua_chan_node == NULL) {
-                       continue;
-               }
-               ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel,
-                               node);
-
-               lttng_ht_lookup(ua_chan->events, (void *)uevent->attr.name, &uiter);
-               ua_event_node = lttng_ht_iter_get_node_str(&uiter);
-               if (ua_event_node == NULL) {
-                       continue;
-               }
-               ua_event = caa_container_of(ua_event_node, struct ust_app_event,
-                               node);
-
-               ret = create_ust_app_event_context(ua_sess, ua_event, &uctx->ctx, app);
-               if (ret < 0) {
-                       continue;
-               }
-       }
-
-       rcu_read_unlock();
-       return ret;
-}
-
 /*
  * Add context to a specific event in a channel for global UST domain.
  */
index ada517e10432113bca7e166bbce618a83d1123f4..605b4a69b5a4a027b5cdde8e5e91d6363720603f 100644 (file)
@@ -72,7 +72,6 @@ struct ust_app_event {
        struct lttng_ust_object_data *obj;
        struct lttng_ust_event attr;
        char name[LTTNG_UST_SYM_NAME_LEN];
-       struct lttng_ht *ctx;
        struct lttng_ht_node_str node;
        struct lttng_ust_filter_bytecode *filter;
 };
@@ -167,9 +166,6 @@ int ust_app_enable_all_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan);
 int ust_app_disable_event_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent);
-int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
-               struct ltt_ust_context *uctx);
 int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx);
 int ust_app_set_filter_event_glb(struct ltt_ust_session *usess,
@@ -317,13 +313,6 @@ int ust_app_enable_event_glb(struct ltt_ust_session *usess,
        return 0;
 }
 static inline
-int ust_app_add_ctx_event_glb(struct ltt_ust_session *usess,
-               struct ltt_ust_channel *uchan, struct ltt_ust_event *uevent,
-               struct ltt_ust_context *uctx)
-{
-       return 0;
-}
-static inline
 int ust_app_add_ctx_channel_glb(struct ltt_ust_session *usess,
                struct ltt_ust_channel *uchan, struct ltt_ust_context *uctx)
 {
index aec2d4df70d8ef991f3d54fdfa1fd4d315ffc019..45357598362ac9c0fb1c2f031609c0c79fd4ea2b 100644 (file)
@@ -31,7 +31,6 @@
 
 #define PRINT_LINE_LEN 80
 
-static char *opt_event_name;
 static char *opt_channel_name;
 static char *opt_session_name;
 static int opt_kernel;
@@ -141,7 +140,6 @@ static struct poptOption long_options[] = {
        {"help",           'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0},
        {"session",        's', POPT_ARG_STRING, &opt_session_name, 0, 0, 0},
        {"channel",        'c', POPT_ARG_STRING, &opt_channel_name, 0, 0, 0},
-       {"event",          'e', POPT_ARG_STRING, &opt_event_name, 0, 0, 0},
        {"kernel",         'k', POPT_ARG_VAL, &opt_kernel, 1, 0, 0},
        {"userspace",      'u', POPT_ARG_NONE, 0, OPT_USERSPACE, 0, 0},
        {"type",           't', POPT_ARG_STRING, &opt_type, OPT_TYPE, 0, 0},
@@ -300,11 +298,10 @@ static void usage(FILE *ofp)
 {
        fprintf(ofp, "usage: lttng add-context -t TYPE [-k|-u] [OPTIONS]\n");
        fprintf(ofp, "\n");
-       fprintf(ofp, "If no channel and no event is given (-c/-e), the context\n");
-       fprintf(ofp, "is added to all events and all channels.\n");
+       fprintf(ofp, "If no channel is given (-c), the context is added to\n");
+       fprintf(ofp, "all channels.\n");
        fprintf(ofp, "\n");
-       fprintf(ofp, "Otherwise the context is added only to the channel (-c)\n");
-       fprintf(ofp, "and/or event (-e) indicated.\n");
+       fprintf(ofp, "Otherwise the context is added only to the channel (-c).\n");
        fprintf(ofp, "\n");
        fprintf(ofp, "Exactly one domain (-k or -u) must be specified.\n");
        fprintf(ofp, "\n");
@@ -313,7 +310,6 @@ static void usage(FILE *ofp)
        fprintf(ofp, "      --list-options       Simple listing of options\n");
        fprintf(ofp, "  -s, --session NAME       Apply to session name\n");
        fprintf(ofp, "  -c, --channel NAME       Apply to channel\n");
-       fprintf(ofp, "  -e, --event NAME         Apply to event\n");
        fprintf(ofp, "  -k, --kernel             Apply to the kernel tracer\n");
        fprintf(ofp, "  -u, --userspace          Apply to the user-space tracer\n");
        fprintf(ofp, "\n");
@@ -326,7 +322,7 @@ static void usage(FILE *ofp)
        fprintf(ofp, "\n");
        fprintf(ofp, "Example:\n");
        fprintf(ofp, "This command will add the context information 'prio' and two perf\n"
-                       "counters (hardware branch misses and cache misses), to all events\n"
+                       "counters (hardware branch misses and cache misses), to all channels\n"
                        "in the trace data output:\n");
        fprintf(ofp, "# lttng add-context -k -t prio -t perf:branch-misses -t perf:cache-misses\n");
        fprintf(ofp, "\n");
@@ -398,25 +394,16 @@ static int add_context(char *session_name)
                }
                DBG("Adding context...");
 
-               ret = lttng_add_context(handle, &context, opt_event_name,
-                               opt_channel_name);
+               ret = lttng_add_context(handle, &context, NULL, opt_channel_name);
                if (ret < 0) {
                        ERR("%s: %s", type->opt->symbol, lttng_strerror(ret));
                        warn = 1;
                        continue;
                } else {
-                       if (opt_channel_name && opt_event_name) {
-                               MSG("%s context %s added to event %s channel %s",
-                                               opt_kernel ? "kernel" : "UST", type->opt->symbol,
-                                               opt_channel_name, opt_event_name);
-                       } else if (opt_channel_name && !opt_event_name) {
+                       if (opt_channel_name) {
                                MSG("%s context %s added to channel %s",
                                                opt_kernel ? "kernel" : "UST", type->opt->symbol,
                                                opt_channel_name);
-                       } else if (!opt_channel_name && opt_event_name) {
-                               MSG("%s context %s added to event %s",
-                                               opt_kernel ? "kernel" : "UST", type->opt->symbol,
-                                               opt_event_name);
                        } else {
                                MSG("%s context %s added to all channels",
                                                opt_kernel ? "kernel" : "UST", type->opt->symbol)
index 5c030a97ef94bb42c2a572856f22735ac12e8adf..88ba54449885c628b441a7d62315eb49ef7d0a9e 100644 (file)
@@ -186,7 +186,6 @@ struct lttcomm_session_msg {
                /* Context */
                struct {
                        char channel_name[LTTNG_SYMBOL_NAME_LEN];
-                       char event_name[LTTNG_SYMBOL_NAME_LEN];
                        struct lttng_event_context ctx;
                } context;
                /* Use by register_consumer */
index 20bb8c6fa0d358c966ebfd3a9cd2e0a836330f3e..4884b0294a0bfcc3aa73b67df222c6a08d845b74 100644 (file)
@@ -749,10 +749,10 @@ int lttng_stop_tracing_no_wait(const char *session_name)
 }
 
 /*
- * Add context to event and/or channel.
- * If event_name is NULL, the context is applied to all events of the channel.
- * If channel_name is NULL, a lookup of the event's channel is done.
- * If both are NULL, the context is applied to all events of all channels.
+ * Add context to a channel.
+ *
+ * If the given channel is NULL, add the contexts to all channels.
+ * The event_name param is ignored.
  *
  * Returns the size of the returned payload data or a negative error code.
  */
@@ -774,9 +774,6 @@ int lttng_add_context(struct lttng_handle *handle,
        /* Copy channel name */
        copy_string(lsm.u.context.channel_name, channel_name,
                        sizeof(lsm.u.context.channel_name));
-       /* Copy event name */
-       copy_string(lsm.u.context.event_name, event_name,
-                       sizeof(lsm.u.context.event_name));
 
        copy_lttng_domain(&lsm.domain, &handle->domain);
 
index 1edd20d6e09864b126a13b40c91d462f8ad6ab8e..ed70f0ffb20118e1f00a3c1e72d37c7f98b3ef73 100644 (file)
@@ -156,7 +156,6 @@ static void create_kernel_event(void)
        printf("Validating kernel event: ");
        assert(event->fd == -1);
        assert(event->enabled == 1);
-       assert(event->ctx == NULL);
        assert(event->event->instrumentation == LTTNG_KERNEL_TRACEPOINT);
        assert(strlen(event->event->name));
        PRINT_OK();
index 69a73b2f235f8ff5bf5046aa2c5f1680428f6ff9..5d4c91b7efdf3c4ba343e2578c380777926be2f9 100644 (file)
@@ -164,7 +164,6 @@ static void create_ust_event(void)
 
        printf("Validating UST event: ");
        assert(event->enabled == 0);
-       assert(event->ctx != NULL);
        assert(event->attr.instrumentation == LTTNG_UST_TRACEPOINT);
        assert(strcmp(event->attr.name, ev.name) == 0);
        assert(event->attr.name[LTTNG_UST_SYM_NAME_LEN - 1] == '\0');
This page took 0.04211 seconds and 5 git commands to generate.