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>
Tue, 8 Sep 2015 12:43:25 +0000 (08:43 -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 83153181fff5e8533e87ea047533d8f3c3bdaf42..c26e5163c993f760885a5e1c7916d32b1397f284 100644 (file)
@@ -1409,16 +1409,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;
@@ -1614,7 +1626,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;
@@ -1697,7 +1710,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);
@@ -1738,6 +1751,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 1c0955c3757b69dbfb5439064ce565fd2300a1ee..91a7a912d02a1dd4f62fe431a6daf5bed789219b 100644 (file)
@@ -243,7 +243,7 @@ int event_ust_enable_all_tracepoints(struct ltt_ust_session *usess,
 
                /* Create ust event */
                uevent = trace_ust_create_event(&events[i], filter_expression,
-                       filter, NULL);
+                               filter, NULL, false);
                if (uevent == NULL) {
                        ret = LTTNG_ERR_FATAL;
                        goto error_destroy;
@@ -290,7 +290,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;
@@ -305,7 +306,7 @@ int event_ust_enable_tracepoint(struct ltt_ust_session *usess,
                        event->loglevel, exclusion);
        if (uevent == NULL) {
                uevent = trace_ust_create_event(event, filter_expression,
-                       filter, exclusion);
+                               filter, exclusion, internal_event);
                /* We have passed ownership */
                filter_expression = NULL;
                filter = NULL;
index cc4a3fa02e0d3f79b5ec52733828aaa35397f0a0..f9b486c2a9a27ed2bfbfe4256608130984d54c47 100644 (file)
@@ -35,7 +35,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 727e928c90b56ae06da06c0a0bca557bcf4893f4..f8064a4c956fdc2e3d3d3bac337ed8d95e18e705 100644 (file)
@@ -374,7 +374,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;
 
@@ -386,6 +387,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 c4dbe06c56c3dd7f3a5c57bcc754d814286b89c4..121d3b0ccc06c471a130aa040a77f74143dffb09 100644 (file)
@@ -52,6 +52,7 @@ struct ltt_ust_event {
        char *filter_expression;
        struct lttng_ust_filter_bytecode *filter;
        struct lttng_event_exclusion *exclusion;
+       bool internal;
 };
 
 /* UST channel */
@@ -185,7 +186,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,
@@ -242,7 +244,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 6df66acbe6ee9e6d6f1ffe5fc083885e673893f9..d83b8b5e346a5644aa5e9782828dd6161bdbab30 100644 (file)
@@ -125,7 +125,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");
 
@@ -166,7 +166,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.033028 seconds and 4 git commands to generate.