Splice (system call)
is a Linux-specific system call that moves data between a file descriptor and a pipe without a round trip to user space. The related system call moves or copies data between a pipe and user space. Ideally, splice and vmsplice work by remapping pages and do not actually copy any data, which may improve I/O performance. As linear addresses do not necessarily correspond to contiguous physical addresses, this may not be possible in all cases and on all hardware combinations. Source: e01 Encyclopedia. Licence: CC BY-SA 4.0.
is a Linux-specific system call that moves data between a file descriptor and a pipe without a round trip to user space. The related system call moves or copies data between a pipe and user space. Ideally, splice and vmsplice work by remapping pages and do not actually copy any data, which may improve I/O performance. As linear addresses do not necessarily correspond to contiguous physical addresses, this may not be possible in all cases and on all hardware combinations. ssize_t splice(int fd_in, loff_t* off_in, int fd_out, loff_t* off_out, size_t len, unsigned int flags); Some constants that are of interest are: // Splice flags (not laid down in stone yet). ifndef SPLICE_F_MOVE define SPLICE_F_MOVE 0x01 endif ifndef SPLICE_F_NONBLOCK define SPLICE_F_NONBLOCK 0x02 endif ifndef SPLICE_F_MORE define SPLICE_F_MORE 0x04 endif ifndef SPLICE_F_GIFT define SPLICE_F_GIFT 0x08 endif // Transfer from disk to a log. int log_blocks (struct log_handle* handle, int fd, loff_t offset, size_t size) { int file_descriptions[2]; size_t to_write = size; int ret = pipe(file_descriptions); if (ret 0) { ret = splice(fd, &offset, file_descriptions[1], NULL, to_write, SPLICE_F_MORE | SPLICE_F_MOVE); if (ret 0) { ret = splice(file_descriptions[0], NULL, handle->fd, &(handle->fd_offset), to_write, SPLICE_F_MORE | SPLICE_F_MOVE); if (ret ==References==
Cite this
"Splice (system call)". 1786736416. e01 Encyclopedia. CC BY-SA 4.0. https://en.wikipedia.org/w/index.php?oldid=1369419942 JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy