The man page for the splice
system call says that splice
may fail and set errno
to EINVAL
if:
Target file system doesn't support splicing; neither of the descriptors refers to a pipe; or offset given for non-seekable device
Which file systems support splicing?
The Linux kernel supports various file systems, but the most commonly used is the ext4 file system. In this article, you will learn more about the development of Linux file systems and the main features of the ext4 system.
splice() 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 vmsplice() moves or copies data between a pipe and user space.
My original answer was partially incorrect, this is a major rewrite.
In Linux 2.6.30.10 and older, splice
returns EINVAL
when the source or target filesystem does not support splicing. Here are the filesystems that do support splicing:
Details follow. Support for splicing in determined in the do_splice_to()
function in the "file to pipe" case and in the do_splice_from()
function in the "pipe to file" case. It is done by checking whether the relevant struct file_operations
contains .splice_read
or .splice_write
, respectively. In order to produce the above lists of filesystems, I've grepped fs/*/file.c
for .splice_read
and .splice_write
.
Starting with Linux 2.6.31, all the filesystems support splicing both in read and write modes.
Details follow. When a filesystem does not have .splice_read
or .splice_write
in its struct file_operations
, a fallback function is used: default_file_splice_read
and default_file_splice_write
, respectively. See do_splice_to()
and do_splice_from()
for implementations. Note: EINVAL
may still be returned for other reasons listed in the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With