Skip to content

Commit

Permalink
Use syscall! for copy_file_range too
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Nov 16, 2020
1 parent a035626 commit cd22381
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions library/std/src/sys/unix/kernel_copy.rs
Expand Up @@ -445,15 +445,15 @@ pub(super) fn copy_regular_files(reader: RawFd, writer: RawFd, max_len: u64) ->
// We store the availability in a global to avoid unnecessary syscalls
static HAS_COPY_FILE_RANGE: AtomicBool = AtomicBool::new(true);

unsafe fn copy_file_range(
fd_in: libc::c_int,
off_in: *mut libc::loff_t,
fd_out: libc::c_int,
off_out: *mut libc::loff_t,
len: libc::size_t,
flags: libc::c_uint,
) -> libc::c_long {
libc::syscall(libc::SYS_copy_file_range, fd_in, off_in, fd_out, off_out, len, flags)
syscall! {
fn copy_file_range(
fd_in: libc::c_int,
off_in: *mut libc::loff_t,
fd_out: libc::c_int,
off_out: *mut libc::loff_t,
len: libc::size_t,
flags: libc::c_uint
) -> libc::ssize_t
}

let has_copy_file_range = HAS_COPY_FILE_RANGE.load(Ordering::Relaxed);
Expand Down

0 comments on commit cd22381

Please sign in to comment.