Fix: loading of live session within userspace domains
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Nov 2015 21:19:38 +0000 (16:19 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 15 May 2016 21:02:32 +0000 (17:02 -0400)
The output of a session is session-specific and not bound to
a domain. The "lttng_set_consumer_url" already acts on a
session-wide basis.

Fixes #973

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/lttng/domain.h
include/lttng/handle.h
src/bin/lttng/commands/create.c
src/common/config/session-config.c
src/lib/lttng-ctl/lttng-ctl.c

index bff134a84f4c13cfe80cb2c0f9e2446419147b1c..1e40b392a8ed18adffcd25fedd4b7ba77f5a491d 100644 (file)
@@ -28,6 +28,7 @@ extern "C" {
  * Domain types: the different possible tracers.
  */
 enum lttng_domain_type {
  * Domain types: the different possible tracers.
  */
 enum lttng_domain_type {
+       LTTNG_DOMAIN_NONE                     = 0,      /* No associated domain. */
        LTTNG_DOMAIN_KERNEL                   = 1,      /* Linux Kernel tracer. */
        LTTNG_DOMAIN_UST                      = 2,      /* Global Userspace tracer. */
        LTTNG_DOMAIN_JUL                      = 3,      /* Java Util Logging. */
        LTTNG_DOMAIN_KERNEL                   = 1,      /* Linux Kernel tracer. */
        LTTNG_DOMAIN_UST                      = 2,      /* Global Userspace tracer. */
        LTTNG_DOMAIN_JUL                      = 3,      /* Java Util Logging. */
index a313e79632fd9457f48c494cbef2ba4b2b5e1486..c5958b4023e3b361a0496122a35e249435942b3f 100644 (file)
@@ -43,7 +43,11 @@ struct lttng_handle {
  * This handle contains the session name and domain on which the command will
  * be executed. A domain is basically a tracer like the kernel or user space.
  *
  * This handle contains the session name and domain on which the command will
  * be executed. A domain is basically a tracer like the kernel or user space.
  *
- * Return an newly allocated handle that should be freed using
+ * A NULL domain indicates that the handle is not bound to a specific domain.
+ * This is mostly used for actions that apply on a session and not on a domain
+ * (e.g lttng_set_consumer_url).
+ *
+ * Return a newly allocated handle that should be freed using
  * lttng_destroy_handle. On error, NULL is returned.
  */
 extern struct lttng_handle *lttng_create_handle(const char *session_name,
  * lttng_destroy_handle. On error, NULL is returned.
  */
 extern struct lttng_handle *lttng_create_handle(const char *session_name,
index 525464aa822d90b556308d830196eb38ed92b898..3379a3b27b8638a3f3455af6cc4b0dca981a90b5 100644 (file)
@@ -141,18 +141,15 @@ static int set_consumer_url(const char *session_name, const char *ctrl_url,
 {
        int ret;
        struct lttng_handle *handle;
 {
        int ret;
        struct lttng_handle *handle;
-       struct lttng_domain dom;
 
        assert(session_name);
 
        /*
 
        assert(session_name);
 
        /*
-        * Set handle with the session name and the domain set to 0. This means to
-        * the session daemon that the next action applies on the tracing session
-        * rather then the domain specific session.
+        * Set handle with the session_name, but no domain. This implies that
+        * the actions taken with this handle apply on the tracing session
+        * rather then the domain-specific session.
         */
         */
-       memset(&dom, 0, sizeof(dom));
-
-       handle = lttng_create_handle(session_name, &dom);
+       handle = lttng_create_handle(session_name, NULL);
        if (handle == NULL) {
                ret = CMD_FATAL;
                goto error;
        if (handle == NULL) {
                ret = CMD_FATAL;
                goto error;
index eea6c0a81d5062e7db0047252f4309d5c3ec7c5c..48094c59a427f9636e5b222c09bd85c6b5c3a0d9 100644 (file)
@@ -1151,17 +1151,16 @@ end:
 }
 
 static
 }
 
 static
-int create_session_net_output(const char *name, struct lttng_domain *domain,
-       const char *control_uri, const char *data_uri)
+int create_session_net_output(const char *name, const char *control_uri,
+               const char *data_uri)
 {
        int ret;
        struct lttng_handle *handle;
        const char *uri = NULL;
 
        assert(name);
 {
        int ret;
        struct lttng_handle *handle;
        const char *uri = NULL;
 
        assert(name);
-       assert(domain);
 
 
-       handle = lttng_create_handle(name, domain);
+       handle = lttng_create_handle(name, NULL);
        if (!handle) {
                ret = -LTTNG_ERR_NOMEM;
                goto end;
        if (!handle) {
                ret = -LTTNG_ERR_NOMEM;
                goto end;
@@ -1343,11 +1342,6 @@ int create_session(const char *name,
        }
 
        if (output.control_uri || output.data_uri) {
        }
 
        if (output.control_uri || output.data_uri) {
-               int i;
-               struct lttng_domain *domain;
-               struct lttng_domain *domains[] =
-                       { kernel_domain, ust_domain, jul_domain, log4j_domain };
-
                /* network destination */
                if (live_timer_interval && live_timer_interval != UINT64_MAX) {
                        /*
                /* network destination */
                if (live_timer_interval && live_timer_interval != UINT64_MAX) {
                        /*
@@ -1363,18 +1357,12 @@ int create_session(const char *name,
                        goto end;
                }
 
                        goto end;
                }
 
-               for (i = 0; i < (sizeof(domains) / sizeof(domains[0])); i++) {
-                       domain = domains[i];
-                       if (!domain) {
-                               continue;
-                       }
-
-                       ret = create_session_net_output(name, domain, output.control_uri,
-                                       output.data_uri);
-                       if (ret) {
-                               goto end;
-                       }
+               ret = create_session_net_output(name, output.control_uri,
+                               output.data_uri);
+               if (ret) {
+                       goto end;
                }
                }
+
        } else {
                /* either local output or no output */
                ret = lttng_create_session(name, output.path);
        } else {
                /* either local output or no output */
                ret = lttng_create_session(name, output.path);
index 4df1bdf3f46050f9ae00a279e1024693c6a995b7..d0deade2e5b2d0216c5012153d7b587b744ae9eb 100644 (file)
@@ -519,10 +519,6 @@ struct lttng_handle *lttng_create_handle(const char *session_name,
 {
        struct lttng_handle *handle = NULL;
 
 {
        struct lttng_handle *handle = NULL;
 
-       if (domain == NULL) {
-               goto end;
-       }
-
        handle = zmalloc(sizeof(struct lttng_handle));
        if (handle == NULL) {
                PERROR("malloc handle");
        handle = zmalloc(sizeof(struct lttng_handle));
        if (handle == NULL) {
                PERROR("malloc handle");
@@ -533,8 +529,10 @@ struct lttng_handle *lttng_create_handle(const char *session_name,
        lttng_ctl_copy_string(handle->session_name, session_name,
                        sizeof(handle->session_name));
 
        lttng_ctl_copy_string(handle->session_name, session_name,
                        sizeof(handle->session_name));
 
-       /* Copy lttng domain */
-       lttng_ctl_copy_lttng_domain(&handle->domain, domain);
+       /* Copy lttng domain or leave initialized to 0. */
+       if (domain) {
+               lttng_ctl_copy_lttng_domain(&handle->domain, domain);
+       }
 
 end:
        return handle;
 
 end:
        return handle;
This page took 0.028816 seconds and 4 git commands to generate.