1 // Copyright 2020 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package unix 6 7 import ( 8 "syscall" 9 "unsafe" 10 ) 11 12 func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { 13 r1, _, errno := syscall.Syscall6(copyFileRangeTrap, 14 uintptr(rfd), 15 uintptr(unsafe.Pointer(roff)), 16 uintptr(wfd), 17 uintptr(unsafe.Pointer(woff)), 18 uintptr(len), 19 uintptr(flags), 20 ) 21 n = int(r1) 22 if errno != 0 { 23 err = errno 24 } 25 return 26 } 27