- unsigned long mmap_offset;
- long ret = 0, written = 0;
- off_t orig_offset = stream->out_fd_offset;
- int outfd = stream->out_fd;
-
- /* get the offset inside the fd to mmap */
- ret = ustctl_get_mmap_read_offset(stream->chan->handle,
- stream->buf, &mmap_offset);
- if (ret != 0) {
- errno = -ret;
- PERROR("ustctl_get_mmap_read_offset");
- written = ret;
- goto end;
- }
- while (len > 0) {
- ret = write(outfd, stream->mmap_base + mmap_offset, len);
- if (ret < 0) {
- if (errno == EINTR) {
- /* restart the interrupted system call */
- continue;
- } else {
- PERROR("Error in file write");
- if (written == 0) {
- written = ret;
- }
- goto end;
- }
- } else if (ret > len) {
- PERROR("Error in file write");
- written += ret;
- goto end;
- } else {
- len -= ret;
- mmap_offset += ret;
- }
- /* This won't block, but will start writeout asynchronously */
- lttng_sync_file_range(outfd, stream->out_fd_offset, ret,
- SYNC_FILE_RANGE_WRITE);
- stream->out_fd_offset += ret;
- written += ret;
- }
- lttng_consumer_sync_trace_file(stream, orig_offset);
-end:
- return written;
-}
-
-/*
- * Splice the data from the ring buffer to the tracefile.
- *
- * Returns the number of bytes spliced.
- */
-ssize_t lttng_ustconsumer_on_read_subbuffer_splice(
- struct lttng_consumer_local_data *ctx,
- struct lttng_consumer_stream *stream, unsigned long len)
-{
- return -ENOSYS;
-}