Skip to content

file_unix: let copy_file_range() manage the fd's offsets

Ahmad Samir requested to merge work/ahmad/file-unix into master

The method signature is: ssize_t copy_file_range(int fd_in, off64_t *off_in, int fd_out, off64_t *off_out, size_t len, unsigned int flags);

and the docs say: If off_in is NULL, then bytes are read from fd_in starting from the file offset, and the file offset is adjusted by the number of bytes copied.

(the same goes for off_out).

So using nullptr is more robust; and we just add the copiedBytes to sizeProcessed.

[1]https://man7.org/linux/man-pages/man2/copy_file_range.2.html

=============================

file_unix: use copy_file_range on FreeBSD too

See https://www.freebsd.org/cgi/man.cgi?query=copy_file_range&sektion=2&format=html

Edited by Ahmad Samir

Merge request reports