* Send all stream fds of UST channel to the consumer.
*/
static int send_channel_streams(int sock,
* Send all stream fds of UST channel to the consumer.
*/
static int send_channel_streams(int sock,
- * We need to keep shm_fd open to make sure this key stays unique within
- * the session daemon.
+ * We need to keep shm_fd open while we transfer the stream file
+ * descriptors to make sure this key stays unique within the
+ * session daemon. We can free the channel shm_fd without
+ * problem after we finished sending stream fds for that
+ * channel.
- fds[0] = uchan->obj->shm_fd;
- fds[1] = uchan->obj->wait_fd;
- ret = lttcomm_send_fds_unix_sock(sock, fds, 2);
+ fd = uchan->obj->shm_fd;
+ ret = lttcomm_send_fds_unix_sock(sock, &fd, 1);
-
- rcu_read_lock();
- hashtable_get_first(uchan->streams, &iter);
- while ((node = hashtable_iter_get_node(&iter)) != NULL) {
- stream = caa_container_of(node, struct ltt_ust_stream, node);
-
+ cds_list_for_each_entry_safe(stream, tmp, &uchan->streams.head, list) {
lum.cmd_type = LTTNG_CONSUMER_ADD_STREAM;
lum.u.stream.channel_key = uchan->obj->shm_fd;
lum.u.stream.stream_key = stream->obj->shm_fd;
lum.u.stream.state = LTTNG_CONSUMER_ACTIVE_STREAM;
lum.cmd_type = LTTNG_CONSUMER_ADD_STREAM;
lum.u.stream.channel_key = uchan->obj->shm_fd;
lum.u.stream.stream_key = stream->obj->shm_fd;
lum.u.stream.state = LTTNG_CONSUMER_ACTIVE_STREAM;
strncpy(lum.u.stream.path_name, stream->pathname, PATH_MAX - 1);
lum.u.stream.path_name[PATH_MAX - 1] = '\0';
DBG("Sending stream %d to consumer", lum.u.stream.stream_key);
strncpy(lum.u.stream.path_name, stream->pathname, PATH_MAX - 1);
lum.u.stream.path_name[PATH_MAX - 1] = '\0';
DBG("Sending stream %d to consumer", lum.u.stream.stream_key);
int fds[2];
/* Send metadata channel fd */
lum.cmd_type = LTTNG_CONSUMER_ADD_CHANNEL;
lum.u.channel.channel_key = usess->metadata->obj->shm_fd;
lum.u.channel.max_sb_size = usess->metadata->attr.subbuf_size;
int fds[2];
/* Send metadata channel fd */
lum.cmd_type = LTTNG_CONSUMER_ADD_CHANNEL;
lum.u.channel.channel_key = usess->metadata->obj->shm_fd;
lum.u.channel.max_sb_size = usess->metadata->attr.subbuf_size;
DBG("Sending metadata channel %d to consumer", lum.u.channel.channel_key);
ret = lttcomm_send_unix_sock(sock, &lum, sizeof(lum));
if (ret < 0) {
perror("send consumer channel");
goto error;
}
DBG("Sending metadata channel %d to consumer", lum.u.channel.channel_key);
ret = lttcomm_send_unix_sock(sock, &lum, sizeof(lum));
if (ret < 0) {
perror("send consumer channel");
goto error;
}
- fds[0] = usess->metadata->obj->shm_fd;
- fds[1] = usess->metadata->obj->wait_fd;
- ret = lttcomm_send_fds_unix_sock(sock, fds, 2);
+ fd = usess->metadata->obj->shm_fd;
+ ret = lttcomm_send_fds_unix_sock(sock, &fd, 1);
lum.u.stream.state = LTTNG_CONSUMER_ACTIVE_STREAM;
lum.u.stream.output = DEFAULT_UST_CHANNEL_OUTPUT;
lum.u.stream.mmap_len = usess->metadata->stream_obj->memory_map_size;
lum.u.stream.state = LTTNG_CONSUMER_ACTIVE_STREAM;
lum.u.stream.output = DEFAULT_UST_CHANNEL_OUTPUT;
lum.u.stream.mmap_len = usess->metadata->stream_obj->memory_map_size;
strncpy(lum.u.stream.path_name, usess->metadata->pathname, PATH_MAX - 1);
lum.u.stream.path_name[PATH_MAX - 1] = '\0';
DBG("Sending metadata stream %d to consumer", lum.u.stream.stream_key);
strncpy(lum.u.stream.path_name, usess->metadata->pathname, PATH_MAX - 1);
lum.u.stream.path_name[PATH_MAX - 1] = '\0';
DBG("Sending metadata stream %d to consumer", lum.u.stream.stream_key);
while ((node = hashtable_iter_get_node(&iter)) != NULL) {
uchan = caa_container_of(node, struct ust_app_channel, node);
while ((node = hashtable_iter_get_node(&iter)) != NULL) {
uchan = caa_container_of(node, struct ust_app_channel, node);