Fix bad channel handling on enable-event
authorDavid Goulet <david.goulet@polymtl.ca>
Wed, 5 Oct 2011 22:09:23 +0000 (18:09 -0400)
committerDavid Goulet <david.goulet@polymtl.ca>
Wed, 5 Oct 2011 22:09:23 +0000 (18:09 -0400)
The channel attributes and name were not passed to the create function
when a channel is requested and did not exist on enable-event.

Signed-off-by: David Goulet <david.goulet@polymtl.ca>
ltt-sessiond/channel.c
ltt-sessiond/channel.h
ltt-sessiond/main.c

index 350bab6ab5a87b96fc12934d3b88cc4df73eba96..10635536c0fbcf5726a666ad9a25ce8d5897752b 100644 (file)
@@ -30,7 +30,7 @@
 /*
  * Return allocated channel attributes.
  */
-static struct lttng_channel *init_default_attr(int dom)
+struct lttng_channel *channel_new_default_attr(int dom)
 {
        struct lttng_channel *chan;
 
@@ -164,7 +164,7 @@ int channel_kernel_create(struct ltt_kernel_session *ksession,
 
        /* Creating channel attributes if needed */
        if (attr == NULL) {
-               attr = init_default_attr(LTTNG_DOMAIN_KERNEL);
+               attr = channel_new_default_attr(LTTNG_DOMAIN_KERNEL);
                if (attr == NULL) {
                        ret = LTTCOMM_FATAL;
                        goto error;
@@ -202,7 +202,7 @@ int channel_ust_create(struct ltt_ust_session *usession,
 
        /* Creating channel attributes if needed */
        if (attr == NULL) {
-               attr = init_default_attr(LTTNG_DOMAIN_UST_PID);
+               attr = channel_new_default_attr(LTTNG_DOMAIN_UST_PID);
                if (attr == NULL) {
                        ret = LTTCOMM_FATAL;
                        goto error;
index 4c368e619feca560e4d2f0752f74b7e343811cc9..dfde7699435fa041e46400905ef3e28bb437cf4c 100644 (file)
@@ -39,4 +39,6 @@ int channel_ust_disable(struct ltt_ust_session *usession,
 int channel_ust_enable(struct ltt_ust_session *usession,
                struct ltt_ust_channel *uchan, int sock);
 
+struct lttng_channel *channel_new_default_attr(int domain);
+
 #endif /* _LTT_CHANNEL_H */
index 8c09339aba2c80d79f60fdb88afbf4481b3ee1e5..f887fa12441d4b94ae74c5710b44d6850a791c23 100644 (file)
@@ -2053,15 +2053,23 @@ static int cmd_enable_event(struct ltt_session *session, int domain,
 {
        int ret;
        struct ltt_kernel_channel *kchan;
+       struct lttng_channel *attr;
 
        switch (domain) {
        case LTTNG_DOMAIN_KERNEL:
                kchan = trace_kernel_get_channel_by_name(channel_name,
                                session->kernel_session);
                if (kchan == NULL) {
+                       attr = channel_new_default_attr(domain);
+                       if (attr == NULL) {
+                               ret = LTTCOMM_FATAL;
+                               goto error;
+                       }
+                       snprintf(attr->name, NAME_MAX, "%s", channel_name);
+
                        /* This call will notify the kernel thread */
                        ret = channel_kernel_create(session->kernel_session,
-                                       NULL, kernel_poll_pipe[1]);
+                                       attr, kernel_poll_pipe[1]);
                        if (ret != LTTCOMM_OK) {
                                goto error;
                        }
This page took 0.039789 seconds and 4 git commands to generate.