| 86 | #[cfg(linux_kernel)] |
| 87 | #[test] |
| 88 | fn 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)] |