From: Jérémie Galarneau Date: Sun, 23 Aug 2015 04:26:28 +0000 (-0400) Subject: Tag events created as side-effect of agent events as internal X-Git-Tag: v2.8.0-rc1~475 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=88f06f1562c6ecd3a5666baa93a57273fbe10437;p=lttng-tools.git Tag events created as side-effect of agent events as internal Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/cmd.c b/src/bin/lttng-sessiond/cmd.c index 30cfc21c4..50ff1632f 100644 --- a/src/bin/lttng-sessiond/cmd.c +++ b/src/bin/lttng-sessiond/cmd.c @@ -1415,16 +1415,28 @@ end: return ret; } + +static int cmd_enable_event_internal(struct ltt_session *session, + struct lttng_domain *domain, + char *channel_name, struct lttng_event *event, + char *filter_expression, + struct lttng_filter_bytecode *filter, + struct lttng_event_exclusion *exclusion, + int wpipe); + /* - * Command LTTNG_ENABLE_EVENT processed by the client thread. - * We own filter, exclusion, and filter_expression. + * Internal version of cmd_enable_event() with a supplemental + * "internal_event" flag which is used to enable internal events which should + * be hidden from clients. Such events are used in the agent implementation to + * enable the events through which all "agent" events are funeled. */ -int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, +static int _cmd_enable_event(struct ltt_session *session, + struct lttng_domain *domain, char *channel_name, struct lttng_event *event, char *filter_expression, struct lttng_filter_bytecode *filter, struct lttng_event_exclusion *exclusion, - int wpipe) + int wpipe, bool internal_event) { int ret, channel_created = 0; struct lttng_channel *attr; @@ -1620,7 +1632,8 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, /* At this point, the session and channel exist on the tracer */ ret = event_ust_enable_tracepoint(usess, uchan, event, - filter_expression, filter, exclusion); + filter_expression, filter, exclusion, + internal_event); /* We have passed ownership */ filter_expression = NULL; filter = NULL; @@ -1703,7 +1716,7 @@ int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, + filter->len); } - ret = cmd_enable_event(session, &tmp_dom, + ret = cmd_enable_event_internal(session, &tmp_dom, (char *) default_chan_name, &uevent, filter_expression, filter_copy, NULL, wpipe); @@ -1744,6 +1757,38 @@ error: return ret; } +/* + * Command LTTNG_ENABLE_EVENT processed by the client thread. + * We own filter, exclusion, and filter_expression. + */ +int cmd_enable_event(struct ltt_session *session, struct lttng_domain *domain, + char *channel_name, struct lttng_event *event, + char *filter_expression, + struct lttng_filter_bytecode *filter, + struct lttng_event_exclusion *exclusion, + int wpipe) +{ + return _cmd_enable_event(session, domain, channel_name, event, + filter_expression, filter, exclusion, wpipe, false); +} + +/* + * Enable an event which is internal to LTTng. An internal should + * never be made visible to clients and are immune to checks such as + * reserved names. + */ +static int cmd_enable_event_internal(struct ltt_session *session, + struct lttng_domain *domain, + char *channel_name, struct lttng_event *event, + char *filter_expression, + struct lttng_filter_bytecode *filter, + struct lttng_event_exclusion *exclusion, + int wpipe) +{ + return _cmd_enable_event(session, domain, channel_name, event, + filter_expression, filter, exclusion, wpipe, true); +} + /* * Command LTTNG_LIST_TRACEPOINTS processed by the client thread. */ diff --git a/src/bin/lttng-sessiond/event.c b/src/bin/lttng-sessiond/event.c index 017efa1d5..85b41bed0 100644 --- a/src/bin/lttng-sessiond/event.c +++ b/src/bin/lttng-sessiond/event.c @@ -194,7 +194,8 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan, struct lttng_event *event, char *filter_expression, struct lttng_filter_bytecode *filter, - struct lttng_event_exclusion *exclusion) + struct lttng_event_exclusion *exclusion, + bool internal_event) { int ret = LTTNG_OK, to_create = 0; struct ltt_ust_event *uevent; diff --git a/src/bin/lttng-sessiond/event.h b/src/bin/lttng-sessiond/event.h index 21fac1ec0..5f6bf07b7 100644 --- a/src/bin/lttng-sessiond/event.h +++ b/src/bin/lttng-sessiond/event.h @@ -36,7 +36,8 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan, struct lttng_event *event, char *filter_expression, struct lttng_filter_bytecode *filter, - struct lttng_event_exclusion *exclusion); + struct lttng_event_exclusion *exclusion, + bool internal_event); int event_ust_disable_tracepoint(struct ltt_ust_session *usess, struct ltt_ust_channel *uchan, char *event_name); diff --git a/src/bin/lttng-sessiond/trace-ust.c b/src/bin/lttng-sessiond/trace-ust.c index 3881084f0..a821aa490 100644 --- a/src/bin/lttng-sessiond/trace-ust.c +++ b/src/bin/lttng-sessiond/trace-ust.c @@ -375,7 +375,8 @@ error: struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, char *filter_expression, struct lttng_filter_bytecode *filter, - struct lttng_event_exclusion *exclusion) + struct lttng_event_exclusion *exclusion, + bool internal_event) { struct ltt_ust_event *lue; @@ -387,6 +388,8 @@ struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, goto error; } + lue->internal = internal_event; + switch (ev->type) { case LTTNG_EVENT_PROBE: lue->attr.instrumentation = LTTNG_UST_PROBE; diff --git a/src/bin/lttng-sessiond/trace-ust.h b/src/bin/lttng-sessiond/trace-ust.h index a65bd30a9..f114628d0 100644 --- a/src/bin/lttng-sessiond/trace-ust.h +++ b/src/bin/lttng-sessiond/trace-ust.h @@ -53,6 +53,7 @@ struct ltt_ust_event { char *filter_expression; struct lttng_ust_filter_bytecode *filter; struct lttng_event_exclusion *exclusion; + bool internal; }; /* UST channel */ @@ -186,7 +187,8 @@ struct ltt_ust_channel *trace_ust_create_channel(struct lttng_channel *attr); struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, char *filter_expression, struct lttng_filter_bytecode *filter, - struct lttng_event_exclusion *exclusion); + struct lttng_event_exclusion *exclusion, + bool internal_event); struct ltt_ust_context *trace_ust_create_context( struct lttng_event_context *ctx); int trace_ust_match_context(struct ltt_ust_context *uctx, @@ -243,7 +245,8 @@ static inline struct ltt_ust_event *trace_ust_create_event(struct lttng_event *ev, const char *filter_expression, struct lttng_filter_bytecode *filter, - struct lttng_event_exclusion *exclusion) + struct lttng_event_exclusion *exclusion, + bool internal_event) { return NULL; } diff --git a/tests/unit/test_ust_data.c b/tests/unit/test_ust_data.c index d7d2e3539..4fb6a315e 100644 --- a/tests/unit/test_ust_data.c +++ b/tests/unit/test_ust_data.c @@ -128,7 +128,7 @@ static void test_create_ust_event(void) ev.type = LTTNG_EVENT_TRACEPOINT; ev.loglevel_type = LTTNG_EVENT_LOGLEVEL_ALL; - event = trace_ust_create_event(&ev, NULL, NULL, NULL); + event = trace_ust_create_event(&ev, NULL, NULL, NULL, false); ok(event != NULL, "Create UST event"); @@ -169,7 +169,7 @@ static void test_create_ust_event_exclusion(void) exclusion->count = 1; strncpy((char *)(exclusion->names), get_random_string(), LTTNG_SYMBOL_NAME_LEN); - event = trace_ust_create_event(&ev, NULL, NULL, exclusion); + event = trace_ust_create_event(&ev, NULL, NULL, exclusion, false); ok(event != NULL, "Create UST event with exclusion");