Add snapshot command to lttng UI
[lttng-tools.git] / src / bin / lttng-sessiond / kernel.c
index 32c40531d21b3e50f4d7b1851594b2ad1090ea4f..69665058a0e098c0b7a2bbd9dc1042d6f7b25f0a 100644 (file)
@@ -81,7 +81,7 @@ int kernel_create_session(struct ltt_session *session, int tracer_fd)
        assert(session);
 
        /* Allocate data structure */
-       lks = trace_kernel_create_session(session->path);
+       lks = trace_kernel_create_session();
        if (lks == NULL) {
                ret = -1;
                goto error;
@@ -110,6 +110,9 @@ int kernel_create_session(struct ltt_session *session, int tracer_fd)
        return 0;
 
 error:
+       if (lks) {
+               trace_kernel_destroy_session(lks);
+       }
        return ret;
 }
 
@@ -118,23 +121,22 @@ error:
  * kernel session.
  */
 int kernel_create_channel(struct ltt_kernel_session *session,
-               struct lttng_channel *chan, char *path)
+               struct lttng_channel *chan)
 {
        int ret;
        struct ltt_kernel_channel *lkc;
 
        assert(session);
        assert(chan);
-       assert(path);
 
        /* Allocate kernel channel */
-       lkc = trace_kernel_create_channel(chan, path);
+       lkc = trace_kernel_create_channel(chan);
        if (lkc == NULL) {
                goto error;
        }
 
-       DBG3("Kernel create channel %s in %s with attr: %d, %" PRIu64 ", %" PRIu64 ", %u, %u, %d",
-                       chan->name, path, lkc->channel->attr.overwrite,
+       DBG3("Kernel create channel %s with attr: %d, %" PRIu64 ", %" PRIu64 ", %u, %u, %d",
+                       chan->name, lkc->channel->attr.overwrite,
                        lkc->channel->attr.subbuf_size, lkc->channel->attr.num_subbuf,
                        lkc->channel->attr.switch_timer_interval, lkc->channel->attr.read_timer_interval,
                        lkc->channel->attr.output);
@@ -164,6 +166,10 @@ int kernel_create_channel(struct ltt_kernel_session *session,
        return 0;
 
 error:
+       if (lkc) {
+               free(lkc->channel);
+               free(lkc);
+       }
        return -1;
 }
 
@@ -354,7 +360,7 @@ error:
 int kernel_open_metadata(struct ltt_kernel_session *session)
 {
        int ret;
-       struct ltt_kernel_metadata *lkm;
+       struct ltt_kernel_metadata *lkm = NULL;
 
        assert(session);
 
@@ -367,7 +373,7 @@ int kernel_open_metadata(struct ltt_kernel_session *session)
        /* Kernel tracer metadata creation */
        ret = kernctl_open_metadata(session->fd, &lkm->conf->attr);
        if (ret < 0) {
-               goto error;
+               goto error_open;
        }
 
        lkm->fd = ret;
@@ -383,6 +389,8 @@ int kernel_open_metadata(struct ltt_kernel_session *session)
 
        return 0;
 
+error_open:
+       trace_kernel_destroy_metadata(lkm);
 error:
        return -1;
 }
@@ -452,6 +460,8 @@ int kernel_metadata_flush_buffer(int fd)
 {
        int ret;
 
+       DBG("Kernel flushing metadata buffer on fd %d", fd);
+
        ret = kernctl_buffer_flush(fd);
        if (ret < 0) {
                ERR("Fail to flush metadata buffers %d (ret: %d)", fd, ret);
@@ -537,6 +547,9 @@ int kernel_open_channel_stream(struct ltt_kernel_channel *channel)
                        PERROR("fcntl session fd");
                }
 
+               lks->tracefile_size = channel->channel->attr.tracefile_size;
+               lks->tracefile_count = channel->channel->attr.tracefile_count;
+
                /* Add stream to channe stream list */
                cds_list_add(&lks->list, &channel->stream_list.head);
                channel->stream_count++;
This page took 0.024194 seconds and 4 git commands to generate.