DBG("Kernel session created (fd: %d)", lks->fd);
+ /*
+ * This is necessary since the creation time is present in the session
+ * name when it is generated.
+ */
+ if (session->has_auto_generated_name) {
+ ret = kernctl_session_set_name(lks->fd, DEFAULT_SESSION_NAME);
+ } else {
+ ret = kernctl_session_set_name(lks->fd, session->name);
+ }
+ if (ret) {
+ WARN("Could not set kernel session name for session %" PRIu64 " name: %s",
+ session->id, session->name);
+ }
+
return 0;
error:
#include <sys/ioctl.h>
#include <string.h>
#include <common/align.h>
+#include <common/macros.h>
#include <errno.h>
#include <stdarg.h>
#include <assert.h>
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,
int kernctl_session_regenerate_metadata(int fd);
int kernctl_session_regenerate_statedump(int fd);
+int kernctl_session_set_name(int fd, const char *name);
/* Buffer operations */
#define LTTNG_KERNEL_SESSION_METADATA_REGEN _IO(0xF6, 0x59)
/* 0x5A and 0x5B are reserved for a future ABI-breaking cleanup. */
#define LTTNG_KERNEL_SESSION_STATEDUMP _IO(0xF6, 0x5C)
+#define LTTNG_KERNEL_SESSION_SET_NAME \
+ _IOR(0xF6, 0x5D, struct lttng_kernel_session_name)
/* Channel FD ioctl */
#define LTTNG_KERNEL_STREAM _IO(0xF6, 0x62)
#define LTTNG_KERNEL_SYM_NAME_LEN 256
#define LTTNG_KERNEL_MAX_UPROBE_NUM 32
+#define LTTNG_KERNEL_SESSION_NAME_LEN 256
/*
* LTTng DebugFS ABI structures.
char data[0];
} LTTNG_PACKED;
+/*
+ * kernel session name
+ */
+struct lttng_kernel_session_name {
+ char name[LTTNG_KERNEL_SESSION_NAME_LEN];
+} LTTNG_PACKED;
+
#endif /* _LTTNG_KERNEL_H */