From c13806d3846ab4c738756722b9c30e4e1c36c35c Mon Sep 17 00:00:00 2001 From: sisungo Date: Fri, 9 Jul 2021 20:14:29 +0800 Subject: [PATCH] Change `os.rs` to build on musl libc --- vm/src/stdlib/os.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vm/src/stdlib/os.rs b/vm/src/stdlib/os.rs index a8dc67f9a..412a91d40 100644 --- a/vm/src/stdlib/os.rs +++ b/vm/src/stdlib/os.rs @@ -1563,8 +1563,12 @@ mod _os { // Safety: p_offset_src and p_offset_dst is a unique pointer for offset_src and offset_dst respectively, // and will only be freed after this function ends. + // + // Why not use `libc::copy_file_range`: On `musl-libc`, `libc::copy_file_range` is not provided. Therefore + // we use syscalls directly instead. let ret = unsafe { - libc::copy_file_range( + libc::syscall( + libc::SYS_copy_file_range, args.src, p_offset_src as *mut i64, args.dst,