Otherwise, the UST session UID gets assigned only when the first UST
channel is created for a session, causing IDs to be used for many
sessions (the count of the number of sessions allocated so far) if the
session creation / channel creation is not performed in a usual
sequence.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
DBG("Creating UST session");
DBG("Creating UST session");
- session_lock_list();
- uid = session_list_ptr->count;
- session_unlock_list();
-
lus = trace_ust_create_session(session->path, uid, domain);
if (lus == NULL) {
ret = LTTCOMM_UST_SESS_FAIL;
lus = trace_ust_create_session(session->path, uid, domain);
if (lus == NULL) {
ret = LTTCOMM_UST_SESS_FAIL;
* Add a ltt_session structure to the global list.
*
* The caller MUST acquire the session list lock before.
* Add a ltt_session structure to the global list.
*
* The caller MUST acquire the session list lock before.
+ * Returns the unique identifier for the session.
-static void add_session_list(struct ltt_session *ls)
+static int add_session_list(struct ltt_session *ls)
{
cds_list_add(&ls->list, <t_session_list.head);
{
cds_list_add(&ls->list, <t_session_list.head);
- ltt_session_list.count++;
+ return ++ltt_session_list.count;
/* Add new session to the session list */
session_lock_list();
/* Add new session to the session list */
session_lock_list();
- add_session_list(new_session);
+ new_session->uid = add_session_list(new_session);
- DBG("Tracing session %s created in %s", name, path);
+ DBG("Tracing session %s created in %s with UID %d", name, path, new_session->uid);
pthread_mutex_t lock;
struct cds_list_head list;
int enabled; /* enabled/started flag */
pthread_mutex_t lock;
struct cds_list_head list;
int enabled; /* enabled/started flag */