Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate libc;
- use libc::vmsplice;
- use libc::c_void;
- fn main() {
- let bufsize = 16 * 1024 * 1024;
- let mut buf = "y\n".repeat(bufsize / 2).into_bytes();
- let iovec = libc::iovec {
- iov_base: buf.as_mut_ptr() as *mut c_void,
- iov_len: bufsize,
- };
- let iov_max = libc::_SC_IOV_MAX as usize;
- unsafe {
- loop {
- vmsplice(1, &iovec, iov_max, libc::SPLICE_F_GIFT);
- }
- }
- }
Add Comment
Please, Sign In to add comment