Skip to content

Commit

Permalink
copy_file_range.2: Clarify that only regular files work
Browse files Browse the repository at this point in the history
PR#273962 reported that copy_file_range(2) did not work
on shared memory objects and returned EINVAL.
Although the reporter felt this was incorrect, it is what
the Linux copy_file_range(2) syscall does.

Since there was no collective agreement that the FreeBSD
semantics should be changed to no longer be Linux compatible,
copy_file_range(2) still works on regular files only.

This man page update clarifies that. If, someday, copy_file_range(2)
is changed to support non-regular files, then the man page will
need to be updated to reflect that.

PR:	273962
Reviewed by:	karels, pauamma_gundo.com (manpages)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43227
  • Loading branch information
Rick Macklem authored and bsdjhb committed Mar 13, 2024
2 parents a994473 + 84b4342 commit 011fd4d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/libc/sys/copy_file_range.2
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd January 2, 2021
.Dd December 28, 2023
.Dt COPY_FILE_RANGE 2
.Os
.Sh NAME
.Nm copy_file_range
.Nd kernel copy of a byte range from one file to another
or within one file
.Nd kernel copy of a byte range from one regular file to another
or within one regular file
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
Expand Down Expand Up @@ -178,9 +178,17 @@ are reset to the initial values for the system call.
.Fa infd
and
.Fa outfd
refer to the same file and the byte ranges overlap or
refer to the same file and the byte ranges overlap.
.It Bq Er EINVAL
The
.Fa flags
is not zero.
argument is not zero.
.It Bq Er EINVAL
Either
.Fa infd
or
.Fa outfd
refers to a file object that is not a regular file.
.It Bq Er EIO
An I/O error occurred while reading/writing the files.
.It Bq Er EINTEGRITY
Expand Down

0 comments on commit 011fd4d

Please sign in to comment.