# Function rustix::io::vmsplice

source · [−]

    pub unsafe fn vmsplice<PipeFd: AsFd>(
        fd: PipeFd,
        bufs: &[IoSliceRaw<'_>],
        flags: SpliceFlags
    ) -> Result<usize>

Expand description

`vmsplice(fd, bufs, flags)`—Transfer data between memory and a pipe.

If `fd` is the write end of the pipe, the function maps the memory pointer at by `bufs` to the pipe.

If `fd` is the read end of the pipe, the function writes data from the pipe to said memory.

## Safety

If the memory must not be mutated (such as when `bufs` were originally immutable slices), it is up to the caller to ensure that the write end of the pipe is placed in `fd`.

Additionally if `SpliceFlags::GIFT` is set, the caller must also ensure that the contents of `bufs` in never modified following the call, and that all of the pointers in `bufs` are page aligned, and the lengths are multiples of a page size in bytes.

## References

- Linux