X-Git-Url: http://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconsumer.c;fp=src%2Fcommon%2Fconsumer.c;h=c511494356369f59727467d835ef08e82bc99a19;hp=024ee17853c03c053dfa0ae4382a7e3763346b1f;hb=060a32b279132ceeeef14b96a611077195a2ca46;hpb=840a73344734b584f7033a2b76628b28c2fa57bf diff --git a/src/common/consumer.c b/src/common/consumer.c index 024ee1785..c51149435 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -1046,30 +1046,45 @@ void *lttng_consumer_thread_poll_fds(void *data) continue; } - /* Take care of high priority channels first. */ + + /* Check if each pipe has data. hack for cygwin. */ for (i = 0; i < nb_fd; i++) { - if (pollfd[i].revents & POLLPRI) { - ssize_t len; + if ((pollfd[i].revents & POLLIN) || + local_stream[i]->hangup_flush_done) { + int check_ret; - DBG("Urgent read on fd %d", pollfd[i].fd); - high_prio = 1; - len = ctx->on_buffer_ready(local_stream[i], ctx); - /* it's ok to have an unavailable sub-buffer */ - if (len < 0 && len != -EAGAIN) { - goto end; - } else if (len > 0) { - local_stream[i]->data_read = 1; + check_ret = lttng_consumer_check_pipe(local_stream[i], ctx); + if (check_ret != 0) { + pollfd[i].revents |= POLLHUP; } } } - /* - * If we read high prio channel in this loop, try again - * for more high prio data. - */ - if (high_prio) { - continue; - } + /* Take care of high priority channels first. */ + /* for (i = 0; i < nb_fd; i++) { */ + /* DBG("!!! POLL FLAGS: %d", pollfd[i].revents); */ + /* if (pollfd[i].revents & POLLPRI) { */ + /* ssize_t len; */ + + /* DBG("Urgent read on fd %d", pollfd[i].fd); */ + /* high_prio = 1; */ + /* len = ctx->on_buffer_ready(local_stream[i], ctx); */ + /* /\* it's ok to have an unavailable sub-buffer *\/ */ + /* if (len < 0 && len != -EAGAIN) { */ + /* goto end; */ + /* } else if (len > 0) { */ + /* local_stream[i]->data_read = 1; */ + /* } */ + /* } */ + /* } */ + + /* /\* */ + /* * If we read high prio channel in this loop, try again */ + /* * for more high prio data. */ + /* *\/ */ + /* if (high_prio) { */ + /* continue; */ + /* } */ /* Take care of low priority channels. */ for (i = 0; i < nb_fd; i++) { @@ -1285,6 +1300,23 @@ ssize_t lttng_consumer_read_subbuffer(struct lttng_consumer_stream *stream, } } +int lttng_consumer_check_pipe(struct lttng_consumer_stream *stream, + struct lttng_consumer_local_data *ctx) +{ + switch (consumer_data.type) { + case LTTNG_CONSUMER_KERNEL: + assert(0); + return -ENOSYS; + case LTTNG_CONSUMER32_UST: + case LTTNG_CONSUMER64_UST: + return lttng_ustconsumer_check_pipe(stream, ctx); + default: + ERR("Unknown consumer_data type"); + assert(0); + return -ENOSYS; + } +} + int lttng_consumer_on_recv_stream(struct lttng_consumer_stream *stream) { switch (consumer_data.type) {