baddr statedump: remove dependency on file streams
[deliverable/lttng-ust.git] / liblttng-ust / lttng-ust-comm.c
index 0a3de32263c068fbffa7c2968218df8dcc14c8a9..08e6299ce3a5bd7793e4ddf04c556e9d04e2e7f8 100644 (file)
@@ -329,6 +329,24 @@ extern void lttng_ring_buffer_client_discard_exit(void);
 extern void lttng_ring_buffer_client_discard_rt_exit(void);
 extern void lttng_ring_buffer_metadata_client_exit(void);
 
+ssize_t lttng_ust_read(int fd, void *buf, size_t len)
+{
+       ssize_t ret;
+       size_t copied = 0, to_copy = len;
+
+       do {
+               ret = read(fd, buf + copied, to_copy);
+               if (ret > 0) {
+                       copied += ret;
+                       to_copy -= ret;
+               }
+       } while ((ret > 0 && to_copy > 0)
+               || (ret < 0 && errno == EINTR));
+       if (ret > 0) {
+               ret = copied;
+       }
+       return ret;
+}
 /*
  * Returns the HOME directory path. Caller MUST NOT free(3) the returned
  * pointer.
This page took 0.024635 seconds and 5 git commands to generate.