Support LTTNG_KERNEL_SESSION_SET_NAME of lttng-modules
[lttng-tools.git] / src / common / kernel-ctl / kernel-ctl.c
index 047d40a34d80ea611ff940a78efdb26ebf9127bd..c9c52b528d582d9282112b4d3d62d1a5903e13cd 100644 (file)
@@ -22,6 +22,7 @@
 #include <sys/ioctl.h>
 #include <string.h>
 #include <common/align.h>
+#include <common/macros.h>
 #include <errno.h>
 #include <stdarg.h>
 #include <assert.h>
@@ -238,6 +239,22 @@ int kernctl_session_regenerate_statedump(int fd)
        return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_STATEDUMP);
 }
 
+int kernctl_session_set_name(int fd, const char *name)
+{
+       int ret;
+       struct lttng_kernel_session_name session_name;
+
+       ret = lttng_strncpy(session_name.name, name, sizeof(session_name.name));
+       if (ret) {
+               goto end;
+       }
+
+       ret = LTTNG_IOCTL_CHECK(
+                       fd, LTTNG_KERNEL_SESSION_SET_NAME, &session_name);
+end:
+       return ret;
+}
+
 int kernctl_create_stream(int fd)
 {
        return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_STREAM,
This page took 0.023006 seconds and 4 git commands to generate.