Deprecate enable/disable-consumer
[lttng-tools.git] / src / bin / lttng-sessiond / session.c
index 7d0ee7d4abb82656d1f9493a58304d5e007bb7f5..076d2cbc46ea9243dbe636350d01592e6d40a880 100644 (file)
@@ -56,6 +56,8 @@ static struct ltt_session_list ltt_session_list = {
  */
 static unsigned int add_session_list(struct ltt_session *ls)
 {
+       assert(ls);
+
        cds_list_add(&ls->list, &ltt_session_list.head);
        return ltt_session_list.next_uuid++;
 }
@@ -67,6 +69,8 @@ static unsigned int add_session_list(struct ltt_session *ls)
  */
 static void del_session_list(struct ltt_session *ls)
 {
+       assert(ls);
+
        cds_list_del(&ls->list);
 }
 
@@ -99,6 +103,8 @@ void session_unlock_list(void)
  */
 void session_lock(struct ltt_session *session)
 {
+       assert(session);
+
        pthread_mutex_lock(&session->lock);
 }
 
@@ -107,6 +113,8 @@ void session_lock(struct ltt_session *session)
  */
 void session_unlock(struct ltt_session *session)
 {
+       assert(session);
+
        pthread_mutex_unlock(&session->lock);
 }
 
@@ -119,6 +127,8 @@ struct ltt_session *session_find_by_name(char *name)
 {
        struct ltt_session *iter;
 
+       assert(name);
+
        DBG2("Trying to find session by name %s", name);
 
        cds_list_for_each_entry(iter, &ltt_session_list.head, list) {
@@ -141,10 +151,7 @@ found:
 int session_destroy(struct ltt_session *session)
 {
        /* Safety check */
-       if (session == NULL) {
-               ERR("Session pointer was null on session destroy");
-               return LTTNG_OK;
-       }
+       assert(session);
 
        DBG("Destroying session %s", session->name);
        del_session_list(session);
@@ -192,11 +199,6 @@ int session_create(char *name, char *path, uid_t uid, gid_t gid)
                        ret = LTTNG_ERR_FATAL;
                        goto error_asprintf;
                }
-               new_session->start_consumer = 1;
-       } else {
-               /* No path indicates that there is no use for a consumer. */
-               new_session->start_consumer = 0;
-               new_session->path[0] = '\0';
        }
 
        /* Init kernel session */
@@ -239,9 +241,7 @@ int session_create(char *name, char *path, uid_t uid, gid_t gid)
 
 error:
 error_asprintf:
-       if (new_session != NULL) {
-               free(new_session);
-       }
+       free(new_session);
 
 error_malloc:
        return ret;
This page took 0.024735 seconds and 4 git commands to generate.