X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=lttng-sessiond%2Fust-app.c;h=9e6b3468b61a6131e652bd3b9b38eb670ac81adf;hb=5485f82241185e6703fe343704c48d2a6d6a4b46;hp=d968577439b0951a4c74ef4ba2e5fb5278b49494;hpb=e30d2b89ae789c3350b02acc3fd51d21fabdb1c4;p=lttng-tools.git diff --git a/lttng-sessiond/ust-app.c b/lttng-sessiond/ust-app.c index d96857743..9e6b3468b 100644 --- a/lttng-sessiond/ust-app.c +++ b/lttng-sessiond/ust-app.c @@ -322,7 +322,7 @@ static struct ust_app_channel *alloc_app_channel(char *name) ua_chan->handle = -1; ua_chan->obj = NULL; ua_chan->ctx = hashtable_new(0); - ua_chan->streams = hashtable_new(0); + CDS_INIT_LIST_HEAD(&ua_chan->streams.head); ua_chan->events = hashtable_new_str(0); hashtable_node_init(&ua_chan->node, (void *) ua_chan->name, strlen(ua_chan->name)); @@ -770,34 +770,33 @@ int ust_app_start_trace(struct ltt_ust_session *usess) ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node); - struct ltt_ust_stream *ustream; + for (;;) { + struct lttng_ust_object_data *obj; + struct ltt_ust_stream *ustream; - ustream = malloc(sizeof(*ustream)); - if (ustream == NULL) { - goto next_chan; - } - - memset(ustream, 0, sizeof(struct ltt_ust_stream)); - - ret = ustctl_create_stream(app->key.sock, ua_chan->obj, - &ustream->obj); - if (ret < 0) { - ERR("Creating channel stream failed"); - goto next_chan; - } - - ustream->handle = ustream->obj->handle; - - hashtable_node_init(&ustream->node, - (void *)((unsigned long) ustream->handle), sizeof(void *)); - hashtable_add_unique(ua_chan->streams, &ustream->node); + ret = ustctl_create_stream(app->key.sock, ua_chan->obj, + &obj); + if (ret < 0) { + /* Got all streams */ + goto next_chan; + } - ret = snprintf(ustream->pathname, PATH_MAX, "%s/%s_%lu", - uchan->pathname, uchan->name, - hashtable_get_count(ua_chan->streams)); - if (ret < 0) { - PERROR("asprintf UST create stream"); - goto next_chan; + ustream = malloc(sizeof(*ustream)); + if (ustream == NULL) { + goto next_chan; + } + memset(ustream, 0, sizeof(struct ltt_ust_stream)); + ustream->obj = obj; + ustream->handle = ustream->obj->handle; + /* Order is important */ + cds_list_add_tail(&ustream->list, &ua_chan->streams.head); + ret = snprintf(ustream->pathname, PATH_MAX, "%s/%s_%u", + uchan->pathname, uchan->name, + ua_chan->streams.count++); + if (ret < 0) { + PERROR("asprintf UST create stream"); + goto next_chan; + } } next_chan: