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);
assert(app);
assert(app->notify_sock >= 0);
+ app->registration_time = time(NULL);
+
rcu_read_lock();
/*
* 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
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.
*/
* 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"