* [PATCH lttng-tools 2/3] Support LTTNG_KERNEL_SESSION_SET_NAME of lttng-modules
[not found] <20190813182651.15629-1-jonathan.rajotte-julien@efficios.com>
@ 2019-08-13 18:26 ` Jonathan Rajotte
2019-08-13 18:26 ` [PATCH lttng-tools 3/3] Support LTTNG_KERNEL_SESSION_SET_CREATION_DATETIME " Jonathan Rajotte
2019-08-13 20:20 ` [PATCH lttng-tools 1/3] Metadata: add env fields to ease lttng path hierarchy creation for viewer Mathieu Desnoyers
2 siblings, 0 replies; 3+ messages in thread
From: Jonathan Rajotte @ 2019-08-13 18:26 UTC (permalink / raw)
To: lttng-dev; +Cc: jgalar
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
---
This should also be backported to 2.11 allowing Babeltrace 2 to merge
traces from archived data (rotation) and output a trace with a similar
lttng tree hierarchy.
See [1] for the series to be applied to lttng-modules.
[1] https://lists.lttng.org/pipermail/lttng-dev/2019-August/029191.html
---
src/bin/lttng-sessiond/kernel.c | 14 ++++++++++++++
src/common/kernel-ctl/kernel-ctl.c | 10 ++++++++++
src/common/kernel-ctl/kernel-ctl.h | 1 +
src/common/kernel-ctl/kernel-ioctl.h | 2 ++
src/common/lttng-kernel.h | 8 ++++++++
5 files changed, 35 insertions(+)
diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c
index b4fc995ce..7793ba6bc 100644
--- a/src/bin/lttng-sessiond/kernel.c
+++ b/src/bin/lttng-sessiond/kernel.c
@@ -125,6 +125,20 @@ int kernel_create_session(struct ltt_session *session, int tracer_fd)
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:
diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c
index 047d40a34..6a37015ae 100644
--- a/src/common/kernel-ctl/kernel-ctl.c
+++ b/src/common/kernel-ctl/kernel-ctl.c
@@ -238,6 +238,16 @@ 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)
+{
+ struct lttng_kernel_session_name session_name;
+
+ strncpy(session_name.name, name, LTTNG_KERNEL_SESSION_NAME_LEN);
+
+ return LTTNG_IOCTL_CHECK(fd, LTTNG_KERNEL_SESSION_SET_NAME,
+ &session_name);
+}
+
int kernctl_create_stream(int fd)
{
return compat_ioctl_no_arg(fd, LTTNG_KERNEL_OLD_STREAM,
diff --git a/src/common/kernel-ctl/kernel-ctl.h b/src/common/kernel-ctl/kernel-ctl.h
index 841c31da0..884929ac1 100644
--- a/src/common/kernel-ctl/kernel-ctl.h
+++ b/src/common/kernel-ctl/kernel-ctl.h
@@ -67,6 +67,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);
/* Buffer operations */
diff --git a/src/common/kernel-ctl/kernel-ioctl.h b/src/common/kernel-ctl/kernel-ioctl.h
index e7ff50b24..ce910e96f 100644
--- a/src/common/kernel-ctl/kernel-ioctl.h
+++ b/src/common/kernel-ctl/kernel-ioctl.h
@@ -145,6 +145,8 @@
#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)
diff --git a/src/common/lttng-kernel.h b/src/common/lttng-kernel.h
index cd1a15f67..001a16e2d 100644
--- a/src/common/lttng-kernel.h
+++ b/src/common/lttng-kernel.h
@@ -27,6 +27,7 @@
#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.
@@ -178,4 +179,11 @@ struct lttng_kernel_filter_bytecode {
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 */
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH lttng-tools 3/3] Support LTTNG_KERNEL_SESSION_SET_CREATION_DATETIME of lttng-modules
[not found] <20190813182651.15629-1-jonathan.rajotte-julien@efficios.com>
2019-08-13 18:26 ` [PATCH lttng-tools 2/3] Support LTTNG_KERNEL_SESSION_SET_NAME of lttng-modules Jonathan Rajotte
@ 2019-08-13 18:26 ` Jonathan Rajotte
2019-08-13 20:20 ` [PATCH lttng-tools 1/3] Metadata: add env fields to ease lttng path hierarchy creation for viewer Mathieu Desnoyers
2 siblings, 0 replies; 3+ messages in thread
From: Jonathan Rajotte @ 2019-08-13 18:26 UTC (permalink / raw)
To: lttng-dev; +Cc: jgalar
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
---
This should also be backported to 2.11 allowing Babeltrace 2 to merge
traces from archived data (rotation) and output a trace with a similar
lttng tree hierarchy.
See [1] for the series to be applied to lttng-modules.
[1] https://lists.lttng.org/pipermail/lttng-dev/2019-August/029191.html
---
src/bin/lttng-sessiond/kernel.c | 6 ++++++
src/common/kernel-ctl/kernel-ctl.c | 15 +++++++++++++++
src/common/kernel-ctl/kernel-ctl.h | 1 +
src/common/kernel-ctl/kernel-ioctl.h | 2 ++
src/common/lttng-kernel.h | 8 ++++++++
5 files changed, 32 insertions(+)
diff --git a/src/bin/lttng-sessiond/kernel.c b/src/bin/lttng-sessiond/kernel.c
index 7793ba6bc..cedb9346c 100644
--- a/src/bin/lttng-sessiond/kernel.c
+++ b/src/bin/lttng-sessiond/kernel.c
@@ -139,6 +139,12 @@ int kernel_create_session(struct ltt_session *session, int tracer_fd)
session->id, session->name);
}
+ ret = kernctl_session_set_creation_time(lks->fd, session->creation_time);
+ if (ret) {
+ WARN("Could not set kernel session creation time for session %" PRIu64 " name: %s",
+ session->id, session->name);
+ }
+
return 0;
error:
diff --git a/src/common/kernel-ctl/kernel-ctl.c b/src/common/kernel-ctl/kernel-ctl.c
index 6a37015ae..8c0025c93 100644
--- a/src/common/kernel-ctl/kernel-ctl.c
+++ b/src/common/kernel-ctl/kernel-ctl.c
@@ -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,
diff --git a/src/common/kernel-ctl/kernel-ctl.h b/src/common/kernel-ctl/kernel-ctl.h
index 884929ac1..053e7df63 100644
--- a/src/common/kernel-ctl/kernel-ctl.h
+++ b/src/common/kernel-ctl/kernel-ctl.h
@@ -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 */
diff --git a/src/common/kernel-ctl/kernel-ioctl.h b/src/common/kernel-ctl/kernel-ioctl.h
index ce910e96f..8d39abbe3 100644
--- a/src/common/kernel-ctl/kernel-ioctl.h
+++ b/src/common/kernel-ctl/kernel-ioctl.h
@@ -147,6 +147,8 @@
#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)
diff --git a/src/common/lttng-kernel.h b/src/common/lttng-kernel.h
index 001a16e2d..2fd14dc1e 100644
--- a/src/common/lttng-kernel.h
+++ b/src/common/lttng-kernel.h
@@ -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.
@@ -186,4 +187,11 @@ struct lttng_kernel_session_name {
char name[LTTNG_KERNEL_SESSION_NAME_LEN];
} LTTNG_PACKED;
+/*
+ * kernel session creation datetime
+ */
+struct lttng_kernel_session_creation_time {
+ char iso8601[LTTNG_KERNEL_SESSION_CREATION_TIME_ISO8601_LEN];
+} LTTNG_PACKED;
+
#endif /* _LTTNG_KERNEL_H */
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH lttng-tools 1/3] Metadata: add env fields to ease lttng path hierarchy creation for viewer
[not found] <20190813182651.15629-1-jonathan.rajotte-julien@efficios.com>
2019-08-13 18:26 ` [PATCH lttng-tools 2/3] Support LTTNG_KERNEL_SESSION_SET_NAME of lttng-modules Jonathan Rajotte
2019-08-13 18:26 ` [PATCH lttng-tools 3/3] Support LTTNG_KERNEL_SESSION_SET_CREATION_DATETIME " Jonathan Rajotte
@ 2019-08-13 20:20 ` Mathieu Desnoyers
2 siblings, 0 replies; 3+ messages in thread
From: Mathieu Desnoyers @ 2019-08-13 20:20 UTC (permalink / raw)
To: Jonathan Rajotte; +Cc: lttng-dev, Jeremie Galarneau
Merging those 3 patches (backported) to my current dev branch at
https://github.com/compudj/lttng-tools-dev/tree/trace-chunk-remote-wip-compudj1
----- On Aug 13, 2019, at 2:26 PM, Jonathan Rajotte jonathan.rajotte-julien@efficios.com wrote:
> Add the following fields in the env section of the metadata:
>
> - trace_name
> The session name without datetime information.
> Hence when the session is an auto-generated one, only print
> LTTNG_DEFAULT_NAME.
> - trace_creation_datetime:
> The datetime at which the session was created.
> We use session->creation time for it.
> - tracer_buffering_scheme
> The buffering scheme used. The value can be uid or pid.
> - tracer_buffering_id
> The key used by the buffering scheme (uid/pid).
> - architecture_bit_width
> The bit width of the computer architecture (e.g 32 or 64)
> - vpid_datetime
> The registration time of the vpid for per-pid mode.
>
> Adding these fields ensure that the trace itself carry information that
> is normally carried via folder hierarchy. e.g
>
> test-20190417-174951/ <- trace_name,
> trace_creation_datetime
> └── ust <- domain
> └── uid <- tracer_buffering_scheme
> └── 1000 <- tracer_buffering_id
> └── 64-bit <- architecture_bit_width
> ├── channel0_0
> ├── index
> │ ├── channel0_0.idx
> └── metadata
>
> Per-pid buffering is quite similar.
>
> auto-20190722-174816 <- trace_name,
> trace_creation_datetime
> └── ust <- domain
> └── pid <- tracer_buffering_scheme
> └── sample-ust-7640-20190722-174818 <- procname, tracer_buffering_id,
> vpid_datetime
> ├── my-channel_0
> ├── index
> │ ├── my-channel_0.idx
> ├── metadata
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
> ---
>
> This should also be backported to 2.11 allowing Babeltrace 2 to merge
> traces from archived data (rotation) and output a trace with a similar
> lttng tree hierarchy.
>
> ---
> src/bin/lttng-sessiond/ust-app.c | 5 +-
> src/bin/lttng-sessiond/ust-metadata.c | 171 ++++++++++++++++++++++----
> src/bin/lttng-sessiond/ust-registry.c | 7 +-
> src/bin/lttng-sessiond/ust-registry.h | 18 ++-
> src/common/time.c | 32 +++++
> src/common/time.h | 9 ++
> 6 files changed, 215 insertions(+), 27 deletions(-)
>
> diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c
> index 443232e79..8b3028c57 100644
> --- a/src/bin/lttng-sessiond/ust-app.c
> +++ b/src/bin/lttng-sessiond/ust-app.c
> @@ -1990,7 +1990,7 @@ static int setup_buffer_reg_pid(struct ust_app_session
> *ua_sess,
> app->byte_order, app->version.major,
> app->version.minor, reg_pid->root_shm_path,
> reg_pid->shm_path,
> - ua_sess->euid, ua_sess->egid);
> + ua_sess->euid, ua_sess->egid, ua_sess->tracing_id, app->uid);
> if (ret < 0) {
> /*
> * reg_pid->registry->reg.ust is NULL upon error, so we need to
> @@ -2057,7 +2057,8 @@ static int setup_buffer_reg_uid(struct ltt_ust_session
> *usess,
> app->uint64_t_alignment, app->long_alignment,
> app->byte_order, app->version.major,
> app->version.minor, reg_uid->root_shm_path,
> - reg_uid->shm_path, usess->uid, usess->gid);
> + reg_uid->shm_path, usess->uid, usess->gid,
> + ua_sess->tracing_id, app->uid);
> if (ret < 0) {
> /*
> * reg_uid->registry->reg.ust is NULL upon error, so we need to
> diff --git a/src/bin/lttng-sessiond/ust-metadata.c
> b/src/bin/lttng-sessiond/ust-metadata.c
> index a657f7c5d..2641c0be1 100644
> --- a/src/bin/lttng-sessiond/ust-metadata.c
> +++ b/src/bin/lttng-sessiond/ust-metadata.c
> @@ -217,6 +217,41 @@ void sanitize_ctf_identifier(char *out, const char *in)
> }
> }
>
> +static
> +int print_escaped_ctf_string(struct ust_registry_session *session, const char
> *string)
> +{
> + int ret;
> + size_t i;
> + char cur;
> +
> + i = 0;
> + cur = string[i];
> + while (cur != '\0') {
> + switch (cur) {
> + case '\n':
> + ret = lttng_metadata_printf(session, "%s", "\\n");
> + break;
> + case '\\':
> + case '"':
> + ret = lttng_metadata_printf(session, "%c", '\\');
> + if (ret)
> + goto error;
> + /* We still print the current char */
> + /* Fallthrough */
> + default:
> + ret = lttng_metadata_printf(session, "%c", cur);
> + break;
> + }
> +
> + if (ret)
> + goto error;
> +
> + cur = string[++i];
> + }
> +error:
> + return ret;
> +}
> +
> /* Called with session registry mutex held. */
> static
> int ust_metadata_enum_statedump(struct ust_registry_session *session,
> @@ -869,6 +904,104 @@ int64_t measure_clock_offset(void)
> return offset_best_sample.offset;
> }
>
> +static
> +int print_metadata_session_information(struct ust_registry_session *registry)
> +{
> + int ret;
> + struct ltt_session *session = NULL;
> + char creation_datetime[ISO8601_LEN];
> +
> + rcu_read_lock();
> + session = session_find_by_id(registry->tracing_id);
> + if (!session) {
> + ret = -1;
> + goto error;
> + }
> +
> +
> + /* Print the trace name */
> + ret = lttng_metadata_printf(registry, " trace_name = \"");
> + if (ret) {
> + goto error;
> + }
> +
> + /*
> + * This is necessary since the creation time is present in the session
> + * name when it is generated.
> + */
> + if (session->has_auto_generated_name) {
> + ret = print_escaped_ctf_string(registry, DEFAULT_SESSION_NAME);
> + } else {
> + ret = print_escaped_ctf_string(registry, session->name);
> + }
> + if (ret) {
> + goto error;
> + }
> +
> + ret = lttng_metadata_printf(registry, "\";\n");
> + if (ret) {
> + goto error;
> + }
> +
> + /* Prepare creation time */
> + ret = time_t_to_ISO8601(creation_datetime, sizeof(creation_datetime),
> + session->creation_time);
> +
> + if (ret) {
> + goto error;
> + }
> +
> + /* Output the reste of the information */
> + ret = lttng_metadata_printf(registry,
> + " trace_creation_datetime = \"%s\";\n"
> + " hostname = \"%s\";\n",
> + creation_datetime,
> + session->hostname);
> + if (ret) {
> + goto error;
> + }
> +
> +error:
> + if (session) {
> + session_put(session);
> + }
> + rcu_read_unlock();
> + return ret;
> +}
> +
> +static
> +int print_metadata_app_information(struct ust_registry_session *registry,
> + struct ust_app *app)
> +{
> + int ret;
> + char datetime[ISO8601_LEN];
> +
> + if (!app) {
> + ret = 0;
> + goto end;
> + }
> +
> + ret = time_t_to_ISO8601(datetime, sizeof(datetime),
> + app->registration_time);
> + if (ret) {
> + goto end;
> + }
> +
> + ret = lttng_metadata_printf(registry,
> + " tracer_patchlevel = %u;\n"
> + " vpid = %d;\n"
> + " procname = \"%s\";\n"
> + " vpid_datetime = \"%s\";\n" ,
> + app->version.patchlevel,
> + (int) app->pid,
> + app->name,
> + datetime
> + );
> +
> +end:
> + return ret;
> +}
> +
> /*
> * Should be called with session registry mutex held.
> */
> @@ -880,7 +1013,6 @@ int ust_metadata_session_statedump(struct
> ust_registry_session *session,
> char uuid_s[UUID_STR_LEN],
> clock_uuid_s[UUID_STR_LEN];
> int ret = 0;
> - char hostname[HOST_NAME_MAX];
>
> assert(session);
>
> @@ -930,41 +1062,36 @@ int ust_metadata_session_statedump(struct
> ust_registry_session *session,
> if (ret)
> goto end;
>
> - /* ignore error, just use empty string if error. */
> - hostname[0] = '\0';
> - ret = gethostname(hostname, sizeof(hostname));
> - if (ret && errno == ENAMETOOLONG)
> - hostname[HOST_NAME_MAX - 1] = '\0';
> ret = lttng_metadata_printf(session,
> "env {\n"
> - " hostname = \"%s\";\n"
> " domain = \"ust\";\n"
> " tracer_name = \"lttng-ust\";\n"
> " tracer_major = %u;\n"
> - " tracer_minor = %u;\n",
> - hostname,
> + " tracer_minor = %u;\n"
> + " tracer_buffering_scheme = \"%s\";\n"
> + " tracer_buffering_id = %u;\n"
> + " architecture_bit_width = %u;\n",
> major,
> - minor
> + minor,
> + app ? "pid" : "uid",
> + app ? (int) app->pid : (int) session->tracing_uid,
> + session->bits_per_long
> );
> if (ret)
> goto end;
>
> + ret = print_metadata_session_information(session);
> + if (ret)
> + goto end;
> +
> /*
> * If per-application registry, we can output extra information
> * about the application.
> */
> - if (app) {
> - ret = lttng_metadata_printf(session,
> - " tracer_patchlevel = %u;\n"
> - " vpid = %d;\n"
> - " procname = \"%s\";\n",
> - app->version.patchlevel,
> - (int) app->pid,
> - app->name
> - );
> - if (ret)
> - goto end;
> - }
> + ret = print_metadata_app_information(session, app);
> + if (ret)
> + goto end;
> +
>
> ret = lttng_metadata_printf(session,
> "};\n\n"
> diff --git a/src/bin/lttng-sessiond/ust-registry.c
> b/src/bin/lttng-sessiond/ust-registry.c
> index a8db79ea6..c495d86b7 100644
> --- a/src/bin/lttng-sessiond/ust-registry.c
> +++ b/src/bin/lttng-sessiond/ust-registry.c
> @@ -880,7 +880,9 @@ int ust_registry_session_init(struct ust_registry_session
> **sessionp,
> const char *root_shm_path,
> const char *shm_path,
> uid_t euid,
> - gid_t egid)
> + gid_t egid,
> + uint64_t tracing_id,
> + uid_t tracing_uid)
> {
> int ret;
> struct ust_registry_session *session;
> @@ -962,6 +964,9 @@ int ust_registry_session_init(struct ust_registry_session
> **sessionp,
> goto error;
> }
>
> + session->tracing_id = tracing_id;
> + session->tracing_uid = tracing_uid;
> +
> pthread_mutex_lock(&session->lock);
> ret = ust_metadata_session_statedump(session, app, major, minor);
> pthread_mutex_unlock(&session->lock);
> diff --git a/src/bin/lttng-sessiond/ust-registry.h
> b/src/bin/lttng-sessiond/ust-registry.h
> index 2940ab7ac..2fc2dff87 100644
> --- a/src/bin/lttng-sessiond/ust-registry.h
> +++ b/src/bin/lttng-sessiond/ust-registry.h
> @@ -131,6 +131,10 @@ struct ust_registry_session {
> */
> uint32_t major;
> uint32_t minor;
> +
> + /* The id of the parent session */
> + uint64_t tracing_id;
> + uid_t tracing_uid;
> };
>
> struct ust_registry_channel {
> @@ -291,7 +295,9 @@ int ust_registry_session_init(struct ust_registry_session
> **sessionp,
> const char *root_shm_path,
> const char *shm_path,
> uid_t euid,
> - gid_t egid);
> + gid_t egid,
> + uint64_t tracing_id,
> + uid_t tracing_uid);
> void ust_registry_session_destroy(struct ust_registry_session *session);
>
> int ust_registry_create_event(struct ust_registry_session *session,
> @@ -351,7 +357,15 @@ int ust_registry_session_init(struct ust_registry_session
> **sessionp,
> uint32_t uint32_t_alignment,
> uint32_t uint64_t_alignment,
> uint32_t long_alignment,
> - int byte_order)
> + int byte_order,
> + uint32_t major,
> + uint32_t minor,
> + const char *root_shm_path,
> + const char *shm_path,
> + uid_t euid,
> + gid_t egid,
> + uint64_t tracing_id,
> + uid_t tracing_uid);
> {
> return 0;
> }
> diff --git a/src/common/time.c b/src/common/time.c
> index a01c16df5..387db3e32 100644
> --- a/src/common/time.c
> +++ b/src/common/time.c
> @@ -16,6 +16,7 @@
> */
>
> #include <common/time.h>
> +#include <common/error.h>
> #include <common/macros.h>
> #include <stddef.h>
> #include <stdint.h>
> @@ -68,6 +69,37 @@ struct timespec timespec_abs_diff(struct timespec t1, struct
> timespec t2)
> return res;
> }
>
> +LTTNG_HIDDEN
> +int time_t_to_ISO8601(char *dest, size_t dest_size, time_t time)
> +{
> + int ret;
> + struct tm tm, *timeinfo;
> +
> + if (dest_size < ISO8601_LEN) {
> + ERR("Failed to format time to ISO8601 destination too small");
> + ret = -1;
> + goto end;
> + }
> +
> + timeinfo = localtime_r(&time, &tm);
> + if (!timeinfo) {
> + PERROR("localtime");
> + ret = -1;
> + goto end;
> + }
> +
> + ret = strftime(dest, dest_size, ISO8601_FORMAT, timeinfo);
> + if (ret == 0) {
> + ERR("Failed to format time to ISO8601");
> + ret = -1;
> + goto end;
> + }
> +
> + ret = 0;
> +end:
> + return ret;
> +}
> +
> static
> void __attribute__((constructor)) init_locale_utf8_support(void)
> {
> diff --git a/src/common/time.h b/src/common/time.h
> index 24513d30b..5ea8c6628 100644
> --- a/src/common/time.h
> +++ b/src/common/time.h
> @@ -46,6 +46,9 @@ bool locale_supports_utf8(void);
> #define MIN_UNIT "m"
> #define HR_UNIT "h"
>
> +#define ISO8601_FORMAT "%Y%m%dT%H%M%S%z"
> +#define ISO8601_LEN 26
> +
> /*
> * timespec_to_ms: Convert timespec to milliseconds.
> *
> @@ -61,4 +64,10 @@ int timespec_to_ms(struct timespec ts, unsigned long *ms);
> LTTNG_HIDDEN
> struct timespec timespec_abs_diff(struct timespec ts_a, struct timespec ts_b);
>
> +/*
> + * Format time_t to ISO8601 compatible format.
> + */
> +LTTNG_HIDDEN
> +int time_t_to_ISO8601(char *s, size_t s_size, time_t time);
> +
> #endif /* LTTNG_TIME_H */
> --
> 2.17.1
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-08-13 20:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20190813182651.15629-1-jonathan.rajotte-julien@efficios.com>
2019-08-13 18:26 ` [PATCH lttng-tools 2/3] Support LTTNG_KERNEL_SESSION_SET_NAME of lttng-modules Jonathan Rajotte
2019-08-13 18:26 ` [PATCH lttng-tools 3/3] Support LTTNG_KERNEL_SESSION_SET_CREATION_DATETIME " Jonathan Rajotte
2019-08-13 20:20 ` [PATCH lttng-tools 1/3] Metadata: add env fields to ease lttng path hierarchy creation for viewer Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).