Re: What are equivalents of Linux ioctl functions FICLONE and FICLONERANGE ?
- In reply to: Dag-Erling_Smørgrav : "Re: What are equivalents of Linux ioctl functions FICLONE and FICLONERANGE ?"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 08 Jun 2024 08:01:52 UTC
On 8 Jun 2024, at 06:36, Dag-Erling Smørgrav <des@freebsd.org> wrote: > > Stefan Esser <se@FreeBSD.org> writes: >> Yuri Victorovich <yuri@FreeBSD.org> writes: >>> On Linux files can be copied with: >>> ioctl(destFd, FICLONE, srcFd) >>> What would be the equivalent of this on FreeBSD? >> That would be copy_file_range(), but as on Linux, it does only >> offer any benefit on filesystems that support copy-on-write or >> potentially on network attached storage. > > Even without filesystem support, it still avoids copying the contents of > the file out to user space, so it's faster than a regular copy. Note that there is no in-kernel fallback path for if the file descriptor type does not support it. This means that you cannot use it, for example, for copies from an anonymous shared memory object to a regular file. David