Support LTTNG_KERNEL_SESSION_SET_CREATION_NAME of lttng-modules
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 23 Apr 2019 18:13:42 +0000 (14:13 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 1 May 2019 21:34:32 +0000 (17:34 -0400)
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
src/bin/lttng-sessiond/kernel.c
src/common/kernel-ctl/kernel-ctl.c
src/common/kernel-ctl/kernel-ctl.h
src/common/kernel-ctl/kernel-ioctl.h
src/common/lttng-kernel.h

index 75b76db2ecc501d0f864dac63d8f580ff2f31452..251d934560dce04fbcaca8667d559d3d321485c4 100644 (file)
@@ -130,6 +130,11 @@ int kernel_create_session(struct ltt_session *session, int tracer_fd)
                WARN("Could not set kernel session name");
        }
 
+       ret = kernctl_session_set_creation_time(lks->fd, session->creation_time);
+       if (ret) {
+               WARN("Could not set kernel session creation time");
+       }
+
        return 0;
 
 error:
index 6a37015ae7bbf9679f8f997eef35495f622827a8..8c0025c93caaef56541c99f292ea4168a91de686 100644 (file)
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <stdarg.h>
 #include <assert.h>
+#include <common/time.h>
 
 #include "kernel-ctl.h"
 #include "kernel-ioctl.h"
@@ -248,6 +249,20 @@ int kernctl_session_set_name(int fd, const char *name)
                        &session_name);
 }
 
+int kernctl_session_set_creation_time(int fd, time_t time)
+{
+       int ret;
+       struct lttng_kernel_session_creation_time creation_time;
+
+       ret = time_t_to_ISO8601(creation_time.iso8601, sizeof(creation_time.iso8601), time);
+       if (ret) {
+               return -1;
+       }
+
+       return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_SET_CREATION_TIME,
+                       &creation_time);
+}
+
 int kernctl_create_stream(int fd)
 {
        return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_STREAM,
index 884929ac17753a5a90a429c56cd63d6534c1c37a..053e7df6314fc1dfd7ba99e8822a5afaf5f5a33e 100644 (file)
@@ -68,6 +68,7 @@ int kernctl_list_tracker_pids(int fd);
 int kernctl_session_regenerate_metadata(int fd);
 int kernctl_session_regenerate_statedump(int fd);
 int kernctl_session_set_name(int fd, const char *name);
+int kernctl_session_set_creation_time(int fd, time_t time);
 
 /* Buffer operations */
 
index ce910e96f64a5c58100342d9b6cd976d94ae577a..8d39abbe38ec882a3c691e07172511a2ff204b27 100644 (file)
 #define LTTNG_KERNEL_SESSION_STATEDUMP         _IO(0xF6, 0x5C)
 #define LTTNG_KERNEL_SESSION_SET_NAME          \
        _IOR(0xF6, 0x5D, struct lttng_kernel_session_name)
+#define LTTNG_KERNEL_SESSION_SET_CREATION_TIME         \
+       _IOR(0xF6, 0x5E, struct lttng_kernel_session_creation_time)
 
 /* Channel FD ioctl */
 #define LTTNG_KERNEL_STREAM                    _IO(0xF6, 0x62)
index 66cc99681259e20dd05cf7462d7d7d0119e2b5d0..54a0738b7bdfec753c138656a273b68eec22cb30 100644 (file)
@@ -28,6 +28,7 @@
 #define LTTNG_KERNEL_SYM_NAME_LEN  256
 #define LTTNG_KERNEL_MAX_UPROBE_NUM  32
 #define LTTNG_KERNEL_SESSION_NAME_LEN  256
+#define LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN 26
 
 /*
  * LTTng DebugFS ABI structures.
@@ -205,5 +206,9 @@ struct lttng_kernel_session_name {
        char name[LTTNG_KERNEL_SESSION_NAME_LEN];
 } LTTNG_PACKED;
 
+struct lttng_kernel_session_creation_time {
+       char iso8601[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN];
+} LTTNG_PACKED;
+
 
 #endif /* _LTTNG_KERNEL_H */
This page took 0.029203 seconds and 5 git commands to generate.