Tag events created as side-effect of agent events as internal
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 23 Aug 2015 04:26:28 +0000 (00:26 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 23 Aug 2015 04:31:27 +0000 (00:31 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/event.c
src/bin/lttng-sessiond/event.h
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/trace-ust.h
tests/unit/test_ust_data.c

index 30cfc21c4f07fc5f90d637d260a8cbe3740b5a41..50ff1632fb1bc3439e3517cdd66cc5129ed85146 100644 (file)
@@ -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.
  */
index 017efa1d5a7d2fd7bd86ac48aa0efb42444b562f..85b41bed001f2ae5bfbe9f661ece22ea54d21e9d 100644 (file)
@@ -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;
index 21fac1ec09a3fba465e16dc74a7f396cb6c31201..5f6bf07b7bef8e0d16e77136d80f2fe0310f0c68 100644 (file)
@@ -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);
 
index 3881084f04fb4024b14970120e44e85c02b1d59d..a821aa4903a5c4d11e84cdc4b67b077af4ff263b 100644 (file)
@@ -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;
index a65bd30a954457ca8ba088244f970bb793f3d10e..f114628d0849f114e74da1879bfdd75748ce1a1a 100644 (file)
@@ -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;
 }
index d7d2e35398ecf8b73a1de05bb3bb4c49a80f1df4..4fb6a315e38c3319d94666ab21eae6bac918ec28 100644 (file)
@@ -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");
 
This page took 0.032248 seconds and 5 git commands to generate.