* 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;
}
/* 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;
}
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;
}
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);
#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:
/*
* 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;
}
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;
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;
}
goto error;
}
- ret = add_kctx_to_channel(&kctx, kchan, event_name);
+ ret = add_kctx_to_channel(&kctx, kchan);
if (ret != LTTNG_OK) {
goto 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
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);
}
}
- /* 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) {
}
}
-end:
switch (ret) {
case -EEXIST:
ret = LTTNG_ERR_UST_CONTEXT_EXIST;
#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 */
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.
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);
{
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;
}
lke->fd = -1;
lke->event = attr;
lke->enabled = 1;
- lke->ctx = NULL;
return lke;
cds_list_del(&event->list);
free(event->event);
- free(event->ctx);
free(event);
}
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;
};
/* 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,
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);
}
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;
};
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);
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 */
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.
*/
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';
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);
- }
}
/*
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.
*/
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... */
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.
*/
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;
};
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,
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)
{
#define PRINT_LINE_LEN 80
-static char *opt_event_name;
static char *opt_channel_name;
static char *opt_session_name;
static int opt_kernel;
{"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},
{
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");
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");
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");
}
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)
/* 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 */
}
/*
- * 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.
*/
/* 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);
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();
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');