/* get the offset inside the fd to mmap */
ret = kernctl_get_mmap_read_offset(fd, &mmap_offset);
if (ret != 0) {
- ret = -errno;
+ errno = -ret;
perror("kernctl_get_mmap_read_offset");
goto end;
}
if (ret >= len) {
len = 0;
} else if (ret < 0) {
- ret = -errno;
+ errno = -ret;
perror("Error in file write");
goto end;
}
SPLICE_F_MOVE | SPLICE_F_MORE);
DBG("splice chan to pipe ret %ld", ret);
if (ret < 0) {
- ret = errno;
+ errno = -ret;
perror("Error in relay splice");
goto splice_error;
}
SPLICE_F_MOVE | SPLICE_F_MORE);
DBG("splice pipe to file %ld", ret);
if (ret < 0) {
- ret = errno;
+ errno = -ret;
perror("Error in file splice");
goto splice_error;
}
ret = kernctl_snapshot(infd);
if (ret != 0) {
- ret = errno;
+ errno = -ret;
perror("Getting sub-buffer snapshot.");
}
ret = kernctl_snapshot_get_produced(infd, pos);
if (ret != 0) {
- ret = errno;
+ errno = -ret;
perror("kernctl_snapshot_get_produced");
}
/* Get the next subbuffer */
err = kernctl_get_next_subbuf(infd);
if (err != 0) {
- ret = errno;
/*
* This is a debug message even for single-threaded consumer,
* because poll() have more relaxed criterions than get subbuf,
/* read the whole subbuffer */
err = kernctl_get_padded_subbuf_size(infd, &len);
if (err != 0) {
- ret = errno;
+ errno = -ret;
perror("Getting sub-buffer len failed.");
goto end;
}
/* read the used subbuffer size */
err = kernctl_get_padded_subbuf_size(infd, &len);
if (err != 0) {
- ret = errno;
+ errno = -ret;
perror("Getting sub-buffer len failed.");
goto end;
}
err = kernctl_put_next_subbuf(infd);
if (err != 0) {
- ret = errno;
+ errno = -ret;
if (errno == EFAULT) {
perror("Error in unreserving sub buffer\n");
} else if (errno == EIO) {
ret = kernctl_get_mmap_len(stream->wait_fd, &mmap_len);
if (ret != 0) {
- ret = errno;
+ errno = -ret;
perror("kernctl_get_mmap_len");
goto error_close_fd;
}
ret = ustctl_get_mmap_read_offset(stream->chan->handle,
stream->buf, &mmap_offset);
if (ret != 0) {
- ret = -errno;
+ errno = -ret;
perror("ustctl_get_mmap_read_offset");
goto end;
}
if (ret >= len) {
len = 0;
} else if (ret < 0) {
- ret = -errno;
+ errno = -ret;
perror("Error in file write");
goto end;
}
ret = ustctl_snapshot(stream->chan->handle, stream->buf);
if (ret != 0) {
- ret = errno;
+ errno = -ret;
perror("Getting sub-buffer snapshot.");
}
ret = ustctl_snapshot_get_produced(stream->chan->handle,
stream->buf, pos);
if (ret != 0) {
- ret = errno;
+ errno = -ret;
perror("kernctl_snapshot_get_produced");
}
if (!stream->hangup_flush_done) {
do {
readlen = read(stream->wait_fd, &dummy, 1);
- } while (readlen == -1 && errno == -EINTR);
+ } while (readlen == -1 && errno == EINTR);
if (readlen == -1) {
ret = readlen;
goto end;