Re: [PATCH] copy.c: use `sendfile()` for in-kernel file copying on Linux
- From
Chris Torek <chris.torek@gmail.com>
- Date
- Feb 13, 2026, 15:36 UTC
- Message-ID
- <CAPx1GvfsnZiUkkXJSAtt4HECT6f+zb1+vtiT+UikcAq0WuFR8Q@mail.gmail.com>
- In-Reply-To
- <20260213124656.218396-1-integral@archlinux.org>
On Fri, Feb 13, 2026 at 4:47 AM George Hu <integral@archlinux.org> wrote:
> The `sendfile()` system call copies data between one file descriptor > and another within the kernel, which is more efficient than the > combination of `read()` and `write()`.
sendfile() is found on other systems (notably BSDs), so perhaps ...
Show 14 quoted lines
> Signed-off-by: George Hu <integral@archlinux.org> > --- > copy.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/copy.c b/copy.c > index b668209b6c..d4b7cde764 100644 > --- a/copy.c > +++ b/copy.c > @@ -7,8 +7,23 @@ > #include "strbuf.h" > #include "abspath.h" > > +#ifdef __linux__
... this and the subsequent ifdef should be based on the feature, rather than the OS.
Chris