about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2020-11-05 14:09:28 -0800
committerJosh Stone <jistone@redhat.com>2020-11-16 11:31:12 -0800
commitcd22381daa7f23bf20a739ac35c95ff77921d9a0 (patch)
tree9ade2e9cce93417f53bffb95c094fbf8a106f0c7
parenta035626eb53e88956680398f5fda821ca0e6bd97 (diff)
downloadrust-cd22381daa7f23bf20a739ac35c95ff77921d9a0.tar.gz
rust-cd22381daa7f23bf20a739ac35c95ff77921d9a0.zip
Use syscall! for copy_file_range too
-rw-r--r--library/std/src/sys/unix/kernel_copy.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/library/std/src/sys/unix/kernel_copy.rs b/library/std/src/sys/unix/kernel_copy.rs
index ac2fcfcb53f..1dc16ef0993 100644
--- a/library/std/src/sys/unix/kernel_copy.rs
+++ b/library/std/src/sys/unix/kernel_copy.rs
@@ -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);