Use lttng_read/lttng_write wrappers
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index 27b40b84ac43dd30b97105bcaa75bd9d610a213c..c6bd5196b4b6cec77e93f7df4af1e076ed952f07 100644 (file)
@@ -32,6 +32,7 @@
 #include <urcu/list.h>
 #include <signal.h>
 
+#include <bin/lttng-consumerd/health-consumerd.h>
 #include <common/common.h>
 #include <common/sessiond-comm/sessiond-comm.h>
 #include <common/relayd/relayd.h>
@@ -43,7 +44,6 @@
 #include <common/index/index.h>
 
 #include "ust-consumer.h"
-#include "../../bin/lttng-consumerd/health-consumerd.h"
 
 extern struct lttng_consumer_global_data consumer_data;
 extern int consumer_poll_timeout;
@@ -1881,14 +1881,16 @@ int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
        /* Ease our life for what's next. */
        ustream = stream->ustream;
 
-       /* We can consume the 1 byte written into the wait_fd by UST */
+       /*
+        * We can consume the 1 byte written into the wait_fd by UST.
+        * Don't trigger error if we cannot read this one byte (read
+        * returns 0), or if the error is EAGAIN or EWOULDBLOCK.
+        */
        if (stream->monitor && !stream->hangup_flush_done) {
                ssize_t readlen;
 
-               do {
-                       readlen = read(stream->wait_fd, &dummy, 1);
-               } while (readlen == -1 && errno == EINTR);
-               if (readlen == -1 && errno != EAGAIN && errno != EWOULDBLOCK) {
+               readlen = lttng_read(stream->wait_fd, &dummy, 1);
+               if (readlen < 0 && errno != EAGAIN && errno != EWOULDBLOCK) {
                        ret = readlen;
                        goto end;
                }
This page took 0.023103 seconds and 4 git commands to generate.