From 940c4592b53105b7c308f8e32b8da136b3d6533d Mon Sep 17 00:00:00 2001 From: Jonathan Rajotte Date: Tue, 13 Aug 2019 16:25:16 -0400 Subject: [PATCH] Save registration time for app MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reuse the registration time for path generation. Signed-off-by: Jonathan Rajotte Signed-off-by: Mathieu Desnoyers Signed-off-by: Jérémie Galarneau --- src/bin/lttng-sessiond/ust-app.c | 7 +++---- src/bin/lttng-sessiond/ust-app.h | 5 +++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/bin/lttng-sessiond/ust-app.c b/src/bin/lttng-sessiond/ust-app.c index e01d43caf..8c9277cae 100644 --- a/src/bin/lttng-sessiond/ust-app.c +++ b/src/bin/lttng-sessiond/ust-app.c @@ -1832,15 +1832,12 @@ static void shadow_copy_channel(struct ust_app_channel *ua_chan, static void shadow_copy_session(struct ust_app_session *ua_sess, struct ltt_ust_session *usess, struct ust_app *app) { - time_t rawtime; struct tm *timeinfo; char datetime[16]; int ret; char tmp_shm_path[PATH_MAX]; - /* Get date and time for unique app path */ - time(&rawtime); - timeinfo = localtime(&rawtime); + timeinfo = localtime(&app->registration_time); strftime(datetime, sizeof(datetime), "%Y%m%d-%H%M%S", timeinfo); DBG2("Shadow copy of session handle %d", ua_sess->handle); @@ -3377,6 +3374,8 @@ void ust_app_add(struct ust_app *app) assert(app); assert(app->notify_sock >= 0); + app->registration_time = time(NULL); + rcu_read_lock(); /* diff --git a/src/bin/lttng-sessiond/ust-app.h b/src/bin/lttng-sessiond/ust-app.h index 59db98e6e..89d97309f 100644 --- a/src/bin/lttng-sessiond/ust-app.h +++ b/src/bin/lttng-sessiond/ust-app.h @@ -297,6 +297,11 @@ struct ust_app { * to a negative value indicating that the agent application is gone. */ int agent_app_sock; + /* + * Time at which the app is registred. + * Used for path creation + */ + time_t registration_time; }; #ifdef HAVE_LIBLTTNG_UST_CTL -- 2.34.1