Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Jun 2024 09:01:52 +0100
From:      David Chisnall <theraven@freebsd.org>
To:        =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@freebsd.org>
Cc:        Stefan Esser <se@freebsd.org>, Yuri Victorovich <yuri@freebsd.org>, freebsd-hackers@freebsd.org
Subject:   Re: What are equivalents of Linux ioctl functions FICLONE and FICLONERANGE ?
Message-ID:  <A74BD85A-D066-4765-A6F7-6CC1A5B194B7@freebsd.org>
In-Reply-To: <86o78c2dxu.fsf@ltc.des.dev>
References:  <86o78c2dxu.fsf@ltc.des.dev>

next in thread | previous in thread | raw e-mail | index | archive | help

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


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?A74BD85A-D066-4765-A6F7-6CC1A5B194B7>