mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c: use select() appropriately for sendfile().
Fixed by Eric Wong. [ruby-core:36150] (maygvl_copy_stream_wait_readwrite): removed. (nogvl_copy_stream_sendfile): use nogvl_copy_stream_wait_write and maygvl_copy_stream_wait_read instead of maygvl_copy_stream_wait_readwrite. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
df3e3768e9
commit
60e078c860
2 changed files with 21 additions and 17 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Sun Jun 12 11:16:59 2011 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* io.c: use select() appropriately for sendfile().
|
||||||
|
Fixed by Eric Wong. [ruby-core:36150]
|
||||||
|
(maygvl_copy_stream_wait_readwrite): removed.
|
||||||
|
(nogvl_copy_stream_sendfile): use nogvl_copy_stream_wait_write and
|
||||||
|
maygvl_copy_stream_wait_read instead of
|
||||||
|
maygvl_copy_stream_wait_readwrite.
|
||||||
|
|
||||||
Sun Jun 12 09:32:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Jun 12 09:32:13 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* atomic.h (ATOMIC_OR): _InterlockedOr is not available on migw.
|
* atomic.h (ATOMIC_OR): _InterlockedOr is not available on migw.
|
||||||
|
|
29
io.c
29
io.c
|
@ -8648,22 +8648,6 @@ simple_sendfile(int out_fd, int in_fd, off_t *offset, off_t count)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SENDFILE
|
#ifdef USE_SENDFILE
|
||||||
static int
|
|
||||||
maygvl_copy_stream_wait_readwrite(int has_gvl, struct copy_stream_struct *stp)
|
|
||||||
{
|
|
||||||
int ret;
|
|
||||||
rb_fd_zero(&stp->fds);
|
|
||||||
rb_fd_set(stp->src_fd, &stp->fds);
|
|
||||||
rb_fd_set(stp->dst_fd, &stp->fds);
|
|
||||||
ret = maygvl_select(has_gvl, rb_fd_max(&stp->fds), &stp->fds, NULL, NULL, NULL);
|
|
||||||
if (ret == -1) {
|
|
||||||
stp->syserr = "select";
|
|
||||||
stp->error_no = errno;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
nogvl_copy_stream_sendfile(struct copy_stream_struct *stp)
|
nogvl_copy_stream_sendfile(struct copy_stream_struct *stp)
|
||||||
{
|
{
|
||||||
|
@ -8746,7 +8730,18 @@ nogvl_copy_stream_sendfile(struct copy_stream_struct *stp)
|
||||||
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
#if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
|
||||||
case EWOULDBLOCK:
|
case EWOULDBLOCK:
|
||||||
#endif
|
#endif
|
||||||
if (maygvl_copy_stream_wait_readwrite(0, stp) == -1)
|
#ifndef linux
|
||||||
|
/*
|
||||||
|
* Linux requires stp->src_fd to be a mmap-able (regular) file,
|
||||||
|
* select() reports regular files to always be "ready", so
|
||||||
|
* there is no need to select() on it.
|
||||||
|
* Other OSes may have the same limitation for sendfile() which
|
||||||
|
* allow us to bypass maygvl_copy_stream_wait_read()...
|
||||||
|
*/
|
||||||
|
if (maygvl_copy_stream_wait_read(0, stp) == -1)
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
|
if (nogvl_copy_stream_wait_write(stp) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
goto retry_sendfile;
|
goto retry_sendfile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue