// Copyright 2020 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package osimport ()varpollCopyFileRange = poll.CopyFileRangefunc ( *File) ( io.Reader) ( int64, bool, error) {// copy_file_range(2) does not support destinations opened with // O_APPEND, so don't even try.if .appendMode {return0, false, nil } := int64(1 << 62) , := .(*io.LimitedReader)if { , = .N, .Rif <= 0 {return0, true, nil } } , := .(*File)if ! {return0, false, nil }if .checkValid("ReadFrom") != nil {// Avoid returning the error as we report handled as false, // leave further error handling as the responsibility of the caller.return0, false, nil } , , = pollCopyFileRange(&.pfd, &.pfd, )if != nil { .N -= }return , , NewSyscallError("copy_file_range", )}