static
int notify_thread_pipe(int wpipe)
{
- int ret;
+ ssize_t ret;
- do {
- ret = write(wpipe, "!", 1);
- } while (ret < 0 && errno == EINTR);
- if (ret < 0 || ret != 1) {
+ ret = lttng_write(wpipe, "!", 1);
+ if (ret < 1) {
PERROR("write poll pipe");
}
- return ret;
+ return (int) ret;
}
/*
static
void *thread_dispatcher(void *data)
{
- int ret, err = -1;
+ int err = -1;
+ ssize_t ret;
struct cds_wfq_node *node;
struct relay_command *relay_cmd = NULL;
* so we can be assured that the data will be read at some point in
* time or wait to the end of the world :)
*/
- do {
- ret = write(live_relay_cmd_pipe[1], relay_cmd,
- sizeof(*relay_cmd));
- } while (ret < 0 && errno == EINTR);
+ ret = lttng_write(live_relay_cmd_pipe[1], relay_cmd,
+ sizeof(*relay_cmd));
free(relay_cmd);
- if (ret < 0 || ret != sizeof(struct relay_command)) {
+ if (ret < sizeof(struct relay_command)) {
PERROR("write cmd pipe");
goto error;
}
stream->index_read_fd = ret;
DBG("Opening index file %s in read only, (fd: %d)", fullpath, ret);
- do {
- health_code_update();
- ret = read(stream->index_read_fd, &hdr, sizeof(hdr));
- } while (ret < 0 && errno == EINTR);
- if (ret < 0) {
+ ret = lttng_read(stream->index_read_fd, &hdr, sizeof(hdr));
+ if (ret < sizeof(hdr)) {
PERROR("Reading index header");
goto error;
}
viewer_index.flags |= LTTNG_VIEWER_FLAG_NEW_METADATA;
}
- do {
- health_code_update();
- ret = read(vstream->index_read_fd, &packet_index,
- sizeof(packet_index));
- } while (ret < 0 && errno == EINTR);
+ ret = lttng_read(vstream->index_read_fd, &packet_index,
+ sizeof(packet_index));
if (ret < sizeof(packet_index)) {
PERROR("Relay reading index file");
viewer_index.status = htobe32(VIEWER_INDEX_ERR);
PERROR("lseek");
goto error;
}
- read_len = read(stream->read_fd, data, len);
- if (read_len < (ssize_t) len) {
+ read_len = lttng_read(stream->read_fd, data, len);
+ if (read_len < len) {
PERROR("Relay reading trace file, fd: %d, offset: %" PRIu64,
stream->read_fd, be64toh(get_packet_info.offset));
goto error;
goto error;
}
- read_len = read(stream->read_fd, data, len);
- if (read_len < (ssize_t) len) {
+ read_len = lttng_read(stream->read_fd, data, len);
+ if (read_len < len) {
PERROR("Relay reading metadata file");
goto error;
}
goto error;
}
- do {
- health_code_update();
- ret = read(fd, relay_connection, sizeof(*relay_connection));
- } while (ret < 0 && errno == EINTR);
- if (ret < 0 || ret < sizeof(*relay_connection)) {
+ ret = lttng_read(fd, relay_connection, sizeof(*relay_connection));
+ if (ret < sizeof(*relay_connection)) {
PERROR("read relay cmd pipe");
goto error_read;
}
/* connection closed */
if (ret <= 0) {
cleanup_poll_connection(&events, pollfd);
- del_connection( relay_connections_ht, &iter,
+ del_connection(relay_connections_ht, &iter,
relay_connection);
DBG("Viewer control connection closed with %d",
pollfd);
return ret;
}
-void live_stop_threads()
+void live_stop_threads(void)
{
int ret;
void *status;