MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / test_vmsplice_write

Function test_vmsplice_write

tests/pipe/splice.rs:88–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86#[cfg(linux_kernel)]
87#[test]
88fn test_vmsplice_write() {
89 use rustix::io::read;
90 use rustix::pipe::{pipe, vmsplice, IoSliceRaw, SpliceFlags};
91
92 let (read_p, write_p) = pipe().unwrap();
93 let mut output = [0; 11];
94 let input = [
95 IoSliceRaw::from_slice(b"hello"),
96 IoSliceRaw::from_slice(b" "),
97 IoSliceRaw::from_slice(b"world"),
98 ];
99
100 unsafe { vmsplice(&write_p, &input, SpliceFlags::empty()).unwrap() };
101 read(&read_p, &mut output).unwrap();
102
103 assert_eq!(&output, b"hello world");
104}
105
106#[cfg(feature = "fs")]
107#[cfg(linux_kernel)]

Callers

nothing calls this directly

Calls 3

pipeFunction · 0.50
vmspliceFunction · 0.50
readFunction · 0.50

Tested by

no test coverage detected