ruby-changes:18173
From: naruse <ko1@a...>
Date: Mon, 13 Dec 2010 21:47:45 +0900 (JST)
Subject: [ruby-changes:18173] Ruby:r30194 (trunk): * io.c (simple_sendfile): disable the use of sendfile(2) on
naruse 2010-12-13 21:28:09 +0900 (Mon, 13 Dec 2010) New Revision: 30194 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=30194 Log: * io.c (simple_sendfile): disable the use of sendfile(2) on FreeBSD. It blocks on TestIO#test_copy_stream_socket. Modified files: trunk/ChangeLog trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 30193) +++ ChangeLog (revision 30194) @@ -1,3 +1,8 @@ +Mon Dec 13 21:26:33 2010 NARUSE, Yui <naruse@r...> + + * io.c (simple_sendfile): disable the use of sendfile(2) on + FreeBSD. It blocks on TestIO#test_copy_stream_socket. + Mon Dec 13 18:35:33 2010 NARUSE, Yui <naruse@r...> * io.c: define USE_SENDFILE on FreeBSD or DragonFly BSD. Index: io.c =================================================================== --- io.c (revision 30193) +++ io.c (revision 30194) @@ -8216,7 +8216,8 @@ return sendfile(out_fd, in_fd, offset, (size_t)count); } -# elif defined(__FreeBSD__) || defined(__DragonFly__) +# elif 0 /* defined(__FreeBSD__) || defined(__DragonFly__) */ +/* at least FreeBSD 8.1 + r30193, sendfiles blocks its execution... */ # define USE_SENDFILE # ifdef HAVE_SYS_UIO_H @@ -8227,14 +8228,16 @@ simple_sendfile(int out_fd, int in_fd, off_t *offset, off_t count) { int r; - size_t sbytes; + off_t sbytes; + struct sf_hdtr hdtr = {NULL, 0, NULL, 0}; # if SIZEOF_OFF_T > SIZEOF_SIZE_T /* we are limited by the 32-bit ssize_t return value on 32-bit */ if (count > (off_t)SSIZE_MAX) count = SSIZE_MAX; # endif - r = sendfile(in_fd, out_fd, *offset, (size_t)count, NULL, &sbytes, 0); + r = sendfile(in_fd, out_fd, offset ? *offset : 0, (size_t)count, &hdtr, &sbytes, SF_NODISKIO); if (r != 0) return -1; + if (offset) *offset = sbytes; return (ssize_t)sbytes; } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/