1 .\" SPDX-License-Identifier: BSD-2-Clause
3 .\" Copyright (c) 2019 Rick Macklem
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 .Nd kernel copy of a byte range from one file to another
46 .Fa "unsigned int flags"
59 It may do this using a file system specific technique if
63 are on the same file system.
66 argument must be opened for reading and the
68 argument must be opened for writing, but not
80 respectively will be used and updated by
81 the number of bytes copied.
88 the byte offset pointed to by
92 respectively will be used/updated and the file offset for
96 respectively will not be affected.
101 This system call attempts to maintain holes in the output file for
102 the byte range being copied.
103 However, this does not always work well.
104 It is recommended that sparse files be copied in a loop using
109 arguments and this system call for the
113 If it succeeds, the call returns the number of bytes copied, which can be fewer
117 should be used in a loop until copying of the desired byte range has been
119 If an error has occurred, a \-1 is returned and the error code is placed in
132 is not open for reading or
135 is not open for writing, or opened for writing with
141 refer to the same file.
143 If the copy exceeds the process's file size limit or the maximum file size
148 A signal interrupted the system call
149 before it could be completed.
150 This may happen for files on some NFS mounts.
151 When this happens, the values pointed to by
155 are reset to the initial values for the system call.
157 If the initial offset for
168 An I/O error occurred while reading/writing the files.
174 refers to a directory.
176 File system that stores
185 system call is expected to be compatible with the Linux system call of