GNU bug report logs - #76623
[PATCH] filesys.c: Use scm_sendfile to copy files.

Previous Next

Package: guile;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Fri, 28 Feb 2025 01:11:03 UTC

Severity: normal

Tags: patch

Done: Rob Browning <rlb <at> defaultvalue.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Tomas Volf <~@wolfsden.cz>
Cc: 76623 <at> debbugs.gnu.org
Subject: bug#76623: [PATCH] filesys.c: Use scm_sendfile to copy files.
Date: Fri, 28 Feb 2025 21:11:10 +0100
[Message part 1 (text/plain, inline)]
Hi,

Tomas Volf <~@wolfsden.cz> skribis:

> Use scm_sendfile instead of read-write loop.  This moves the work into
> the kernel, improving performance.  This implements Ludovic's suggestion
> from bug 68504.
>
> * libguile/filesys.c (scm_copy_file2): Use scm_sendfile.

Nice!  I had to apply the changes below to appease GCC.

The patch LGTM but I realize there’s no real ‘copy-file’ test.  Not your
fault but would you mind adding one or two tests?

Thanks,
Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/libguile/filesys.c b/libguile/filesys.c
index 00171dade..4f861ab35 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -1306,10 +1306,9 @@ SCM_DEFINE (scm_copy_file2, "copy-file", 2, 0, 1,
 {
   char *c_oldfile, *c_newfile;
   int oldfd, newfd;
-  int n, rv;
+  int rv;
   SCM cow = sym_auto;
   int clone_res;
-  char buf[BUFSIZ];
   struct stat_or_stat64 oldstat;
 
   scm_dynwind_begin (0);

This bug report was last modified 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.