Remove "lib" prefix from .c/.h file names
[lttng-tools.git] / ltt-sessiond / kernel-ctl.c
index 09a3763eb835c30aaaa25fca4081f27d34aeb881..cfea8942da7f421d4eeaf272f59b51261fe08e3e 100644 (file)
@@ -25,7 +25,7 @@
 #include <unistd.h>
 
 #include "lttngerr.h"
-#include "libkernelctl.h"
+#include "kernelctl.h"
 #include "kernel-ctl.h"
 
 /*
@@ -41,7 +41,12 @@ int kernel_add_channel_context(struct ltt_kernel_channel *chan,
        DBG("Adding context to channel %s", chan->channel->name);
        ret = kernctl_add_context(chan->fd, ctx);
        if (ret < 0) {
-               perror("add context ioctl");
+               if (errno != EEXIST) {
+                       perror("add context ioctl");
+               } else {
+                       /* If EEXIST, we just ignore the error */
+                       ret = 0;
+               }
                goto error;
        }
 
@@ -403,6 +408,23 @@ void kernel_wait_quiescent(int fd)
        }
 }
 
+/*
+ *  kernel_calibrate
+ */
+int kernel_calibrate(int fd, struct lttng_kernel_calibrate *calibrate)
+{
+       int ret;
+
+       ret = kernctl_calibrate(fd, calibrate);
+       if (ret < 0) {
+               perror("calibrate ioctl");
+               return -1;
+       }
+
+       return 0;
+}
+
+
 /*
  *  kernel_metadata_flush_buffer
  *
@@ -577,7 +599,7 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
 
        while ((size = fscanf(fp, "event { name = %m[^;]; };%n\n", &event, &pos)) == 1) {
                if (count > nbmem) {
-                       DBG("Reallocating event list from %zd to %zd bytes", nbmem,
+                       DBG("Reallocating event list from %zu to %zu bytes", nbmem,
                                        nbmem + KERNEL_EVENT_LIST_SIZE);
                        /* Adding the default size again */
                        nbmem += KERNEL_EVENT_LIST_SIZE;
@@ -587,13 +609,14 @@ ssize_t kernel_list_events(int tracer_fd, struct lttng_event **events)
                                goto error;
                        }
                }
-               strncpy(elist[count].name, event, strlen(event));
+               strncpy(elist[count].name, event, LTTNG_SYMBOL_NAME_LEN);
+               elist[count].name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                count++;
        }
 
        *events = elist;
 
-       DBG("Kernel list events done (%ld events)", count);
+       DBG("Kernel list events done (%zu events)", count);
 
        return count;
 
This page took 0.023507 seconds and 4 git commands to generate.