doc/man: only mention `-llttng-ust-common` in synopses (conditionally)
[lttng-ust.git] / src / common / utils.c
1 /*
2 * SPDX-License-Identifier: LGPL-2.1-only
3 *
4 * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
5 * Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 */
7
8 #include <errno.h>
9 #include <stdio.h>
10 #include <unistd.h>
11
12 #include "common/utils.h"
13
14 ssize_t lttng_ust_read(int fd, void *buf, size_t len)
15 {
16 ssize_t ret;
17 size_t copied = 0, to_copy = len;
18
19 do {
20 ret = read(fd, buf + copied, to_copy);
21 if (ret > 0) {
22 copied += ret;
23 to_copy -= ret;
24 }
25 } while ((ret > 0 && to_copy > 0)
26 || (ret < 0 && errno == EINTR));
27 if (ret > 0) {
28 ret = copied;
29 }
30 return ret;
31 }
This page took 0.034991 seconds and 4 git commands to generate.