Add lttng-error.h containing every API err. code
[lttng-tools.git] / src / bin / lttng-sessiond / kernel.c
index 6fce7d84fd01644f99e30b091f61f0edc4890cc2..34695efff568e3855e8df32f79af4a895ecc97a0 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
+#include <inttypes.h>
 
 #include <common/common.h>
 #include <common/kernel-ctl/kernel-ctl.h>
 #include <common/sessiond-comm/sessiond-comm.h>
 
+#include "consumer.h"
 #include "kernel.h"
 #include "kern-modules.h"
 
@@ -150,7 +152,7 @@ int kernel_create_channel(struct ltt_kernel_session *session,
                goto error;
        }
 
-       DBG3("Kernel create channel %s in %s with attr: %d, %zu, %zu, %u, %u, %d",
+       DBG3("Kernel create channel %s in %s with attr: %d, %" PRIu64 ", %" PRIu64 ", %u, %u, %d",
                        chan->name, path, 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,
@@ -305,7 +307,7 @@ int kernel_enable_event(struct ltt_kernel_event *event)
        if (ret < 0) {
                switch (errno) {
                case EEXIST:
-                       ret = LTTCOMM_KERN_EVENT_EXIST;
+                       ret = LTTNG_ERR_KERN_EVENT_EXIST;
                        break;
                default:
                        PERROR("enable kernel event");
@@ -334,7 +336,7 @@ int kernel_disable_event(struct ltt_kernel_event *event)
        if (ret < 0) {
                switch (errno) {
                case EEXIST:
-                       ret = LTTCOMM_KERN_EVENT_EXIST;
+                       ret = LTTNG_ERR_KERN_EVENT_EXIST;
                        break;
                default:
                        PERROR("disable kernel event");
@@ -717,3 +719,21 @@ int init_kernel_workarounds(void)
 end_boot_id:
        return 0;
 }
+
+/*
+ * Complete teardown of a kernel session.
+ */
+void kernel_destroy_session(struct ltt_kernel_session *ksess)
+{
+       if (ksess == NULL) {
+               DBG3("No kernel session when tearing down session");
+               return;
+       }
+
+       DBG("Tearing down kernel session");
+
+       /* Close any relayd session */
+       consumer_output_send_destroy_relayd(ksess->consumer);
+
+       trace_kernel_destroy_session(ksess);
+}
This page took 0.024997 seconds and 4 git commands to generate.