-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement copy_file_range() system call for Linux #941
Comments
If you're interested, feel free to submit a patch. Nix works 99% on user contributions. |
How I should handle the Here's what I've got at the moment (haven't tested it yet but it compiles): #[cfg(any(target_os = "linux", target_os = "android"))]
pub fn copy_file_range(fd_in: RawFd, off_in: Option<&mut libc::loff_t>,
fd_out: RawFd, off_out: Option<&mut libc::loff_t>,
len: usize) -> Result<usize> {
let off_in = off_in.map(|offset| offset as *mut _).unwrap_or(ptr::null_mut());
let off_out = off_out.map(|offset| offset as *mut _).unwrap_or(ptr::null_mut());
let ret = unsafe {
libc::syscall(libc::SYS_copy_file_range, fd_in, off_in, fd_out, off_out, len, 0 )
};
Errno::result(ret).map(|r| r as usize)
} I just leave out the flags argument, but this is not good for forwards compatibility. |
There are two choices:
|
copy_file_range() has yet to be implemented.
The text was updated successfully, but these errors were encountered: