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.
12 var pollCopyFileRange
= poll
.CopyFileRange
14 func (f
*File
) readFrom(r io
.Reader
) (written
int64, handled
bool, err error
) {
15 // copy_file_range(2) does not support destinations opened with
16 // O_APPEND, so don't even try.
21 remain
:= int64(1 << 62)
23 lr
, ok
:= r
.(*io
.LimitedReader
)
25 remain
, r
= lr
.N
, lr
.R
35 if src
.checkValid("ReadFrom") != nil {
36 // Avoid returning the error as we report handled as false,
37 // leave further error handling as the responsibility of the caller.
41 written
, handled
, err
= pollCopyFileRange(&f
.pfd
, &src
.pfd
, remain
)
45 return written
, handled
, NewSyscallError("copy_file_range", err
)