struct lttng_ust_event_ht events_ht; /* ht of events */
void *owner; /* object owner */
int tstate:1; /* Transient enable state */
+
+ /* New UST 2.4 */
+ int statedump_pending:1;
};
struct lttng_transport {
struct cds_list_head *lttng_get_probe_list_head(void);
int lttng_session_active(void);
+typedef int (*t_statedump_func_ptr)(struct lttng_session *session);
+int lttng_handle_pending_statedumps(t_statedump_func_ptr statedump_func_ptr);
+
#endif /* _LTTNG_UST_EVENTS_H */
CMM_ACCESS_ONCE(session->active) = 1;
CMM_ACCESS_ONCE(session->been_active) = 1;
- lttng_ust_sockinfo_session_enabled(session->owner, session);
+ session->statedump_pending = 1;
+ lttng_ust_sockinfo_session_enabled(session->owner);
end:
return ret;
}
return 0;
}
+/*
+ * Called after session enable: For each session, execute pending statedumps.
+ */
+int lttng_handle_pending_statedumps(t_statedump_func_ptr statedump_func_ptr)
+{
+ struct lttng_session *session;
+
+ cds_list_for_each_entry(session, &sessions, node) {
+ if (session->statedump_pending) {
+ session->statedump_pending = 0;
+ statedump_func_ptr(session);
+ }
+ }
+ return 0;
+}
+
/*
* Only used internally at session destruction.
*/
int lttng_get_notify_socket(void *owner);
-void lttng_ust_sockinfo_session_enabled(void *owner,
- struct lttng_session *session_enabled);
+void lttng_ust_sockinfo_session_enabled(void *owner);
#endif /* _LTTNG_TRACER_CORE_H */
char wait_shm_path[PATH_MAX];
char *wait_shm_mmap;
- struct lttng_session *session_enabled;
+ int session_enabled;
};
/* Socket from app (connect) to session daemon (listen) for communication */
.wait_shm_path = "/" LTTNG_UST_WAIT_FILENAME,
- .session_enabled = NULL,
+ .session_enabled = 0,
};
/* TODO: allow global_apps_sock_path override */
.socket = -1,
.notify_socket = -1,
- .session_enabled = NULL,
+ .session_enabled = 0,
};
static int wait_poll_fallback;
return ret;
}
+static
+void handle_pending_statedumps(struct sock_info *sock_info)
+{
+ int ctor_passed = sock_info->constructor_sem_posted;
+
+ if (ctor_passed && sock_info->session_enabled) {
+ sock_info->session_enabled = 0;
+ lttng_handle_pending_statedumps(<tng_ust_baddr_statedump);
+ }
+}
+
static
void cleanup_sock_info(struct sock_info *sock_info, int exiting)
{
if (ret) {
ERR("Error handling message for %s socket", sock_info->name);
} else {
- struct lttng_session *session;
-
- session = sock_info->session_enabled;
- if (session) {
- sock_info->session_enabled = NULL;
- lttng_ust_baddr_statedump(session);
- }
+ handle_pending_statedumps(sock_info);
}
continue;
default:
lttng_ust_init();
}
-void lttng_ust_sockinfo_session_enabled(void *owner,
- struct lttng_session *session_enabled)
+void lttng_ust_sockinfo_session_enabled(void *owner)
{
struct sock_info *sock_info = owner;
- sock_info->session_enabled = session_enabled;
+ sock_info->session_enabled = 1;
}