guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-230-g11ed4


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-230-g11ed427
Date: Mon, 25 Mar 2013 12:52:21 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=11ed42771dec06626457eae58f2f334df1397f72

The branch, stable-2.0 has been updated
       via  11ed42771dec06626457eae58f2f334df1397f72 (commit)
       via  f28885f4957882c4d96bdfee11d26cd265539aac (commit)
       via  45417ab1066b3f7f65ff4ff4f6ca2733c75bd521 (commit)
      from  86fafc440220b0ab1d76439e89ac8114a9c7660d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 11ed42771dec06626457eae58f2f334df1397f72
Author: Ludovic Courtès <address@hidden>
Date:   Mon Mar 25 13:51:57 2013 +0100

    sendfile: Make sure we have a Linux-style `sendfile'.
    
    * libguile/filesys.c (scm_sendfile): Change conditional to
      HAVE_SYS_SENDFILE_H && HAVE_SENDFILE.

commit f28885f4957882c4d96bdfee11d26cd265539aac
Author: Ludovic Courtès <address@hidden>
Date:   Mon Mar 25 13:28:42 2013 +0100

    sendfile: Check return value of `lseek'.
    
    * libguile/filesys.c (scm_sendfile): Check return value of
      `lseek_or_lseek64', and use `SCM_SYSERROR' upon error.

commit 45417ab1066b3f7f65ff4ff4f6ca2733c75bd521
Author: Ludovic Courtès <address@hidden>
Date:   Mon Mar 25 13:26:52 2013 +0100

    Skip relevant `sendfile' tests when thread support is lacking.
    
    * test-suite/tests/filesys.test ("sendfile")["pipe", "pipe with
      offset"]: Throw to `unresolved' when not (provided? 'threads).

-----------------------------------------------------------------------

Summary of changes:
 libguile/filesys.c            |    9 ++++-
 test-suite/tests/filesys.test |   64 +++++++++++++++++++++-------------------
 2 files changed, 41 insertions(+), 32 deletions(-)

diff --git a/libguile/filesys.c b/libguile/filesys.c
index 6804db9..d318ae7 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -1136,7 +1136,9 @@ SCM_DEFINE (scm_sendfile, "sendfile", 3, 1, 0,
   c_count = scm_to_size_t (count);
   c_offset = SCM_UNBNDP (offset) ? 0 : scm_to_off_t (offset);
 
-#ifdef HAVE_SENDFILE
+#if defined HAVE_SYS_SENDFILE_H && defined HAVE_SENDFILE
+  /* The Linux-style sendfile(2), which is different from the BSD-style.  */
+
   result = sendfile_or_sendfile64 (out_fd, in_fd,
                                   SCM_UNBNDP (offset) ? NULL : &c_offset,
                                   c_count);
@@ -1157,7 +1159,10 @@ SCM_DEFINE (scm_sendfile, "sendfile", 3, 1, 0,
        if (SCM_PORTP (in))
          scm_seek (in, offset, scm_from_int (SEEK_SET));
        else
-         lseek_or_lseek64 (in_fd, c_offset, SEEK_SET);
+         {
+           if (lseek_or_lseek64 (in_fd, c_offset, SEEK_SET) < 0)
+             SCM_SYSERROR;
+         }
       }
 
     for (result = 0, left = c_count; result < c_count; )
diff --git a/test-suite/tests/filesys.test b/test-suite/tests/filesys.test
index c80c295..21b8937 100644
--- a/test-suite/tests/filesys.test
+++ b/test-suite/tests/filesys.test
@@ -158,38 +158,42 @@
         (bytevector=? ref out))))
 
   (pass-if "pipe"
-    (let* ((file   (search-path %load-path "ice-9/boot-9.scm"))
-           (in+out (pipe))
-           (child  (call-with-new-thread
-                    (lambda ()
-                      (call-with-input-file file
-                        (lambda (input)
-                          (let ((len (stat:size (stat input))))
-                            (sendfile (cdr in+out) (fileno input) len 0)
-                            (close-port (cdr in+out)))))))))
-      (let ((ref (call-with-input-file file get-bytevector-all))
-            (out (get-bytevector-all (car in+out))))
-        (close-port (car in+out))
-        (bytevector=? ref out))))
+    (if (provided? 'threads)
+        (let* ((file   (search-path %load-path "ice-9/boot-9.scm"))
+               (in+out (pipe))
+               (child  (call-with-new-thread
+                        (lambda ()
+                          (call-with-input-file file
+                            (lambda (input)
+                              (let ((len (stat:size (stat input))))
+                                (sendfile (cdr in+out) (fileno input) len 0)
+                                (close-port (cdr in+out)))))))))
+          (let ((ref (call-with-input-file file get-bytevector-all))
+                (out (get-bytevector-all (car in+out))))
+            (close-port (car in+out))
+            (bytevector=? ref out)))
+        (throw 'unresolved)))
 
   (pass-if "pipe with offset"
-    (let* ((file   (search-path %load-path "ice-9/boot-9.scm"))
-           (in+out (pipe))
-           (child  (call-with-new-thread
-                    (lambda ()
-                      (call-with-input-file file
-                        (lambda (input)
-                          (let ((len (stat:size (stat input))))
-                            (sendfile (cdr in+out) (fileno input)
-                                      (- len 777) 777)
-                            (close-port (cdr in+out)))))))))
-      (let ((ref (call-with-input-file file
-                   (lambda (input)
-                     (seek input 777 SEEK_SET)
-                     (get-bytevector-all input))))
-            (out (get-bytevector-all (car in+out))))
-        (close-port (car in+out))
-        (bytevector=? ref out)))))
+    (if (provided? 'threads)
+        (let* ((file   (search-path %load-path "ice-9/boot-9.scm"))
+               (in+out (pipe))
+               (child  (call-with-new-thread
+                        (lambda ()
+                          (call-with-input-file file
+                            (lambda (input)
+                              (let ((len (stat:size (stat input))))
+                                (sendfile (cdr in+out) (fileno input)
+                                          (- len 777) 777)
+                                (close-port (cdr in+out)))))))))
+          (let ((ref (call-with-input-file file
+                       (lambda (input)
+                         (seek input 777 SEEK_SET)
+                         (get-bytevector-all input))))
+                (out (get-bytevector-all (car in+out))))
+            (close-port (car in+out))
+            (bytevector=? ref out)))
+        (throw 'unresolved))))
 
 (delete-file (test-file))
 (delete-file (test-symlink))


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]