summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-12 06:10:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-04-12 06:10:21 +0000
commita60e00fde84929b2b5b3943107ce2bae3db14935 (patch)
tree28c83bb96111a7d038a477f54c10969385bbd83c
parent1baa57b00331e5bedd6253dbf4dadc490a480f81 (diff)
wait.c: no EOF
* ext/io/wait/wait.c (io_wait_readable): simply returns that IO is readable without blocking, but no longer returns EOF. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--ext/io/wait/wait.c18
2 files changed, 12 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 63443a5510..de3d993a06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
-Sun Apr 12 15:08:13 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sun Apr 12 15:10:18 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * ext/io/wait/wait.c (io_wait_readable): simply returns that IO is
+ readable without blocking, but no longer returns EOF.
* ext/io/wait/wait.c (io_ready_p, io_wait_readable): try polling
first and check FIONREAD optionally to see if EOF.
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index c48104f16d..99435460d4 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -117,13 +117,14 @@ io_ready_p(VALUE io)
/*
* call-seq:
- * io.wait -> IO, true, false or nil
- * io.wait(timeout) -> IO, true, false or nil
- * io.wait_readable -> IO, true, false or nil
- * io.wait_readable(timeout) -> IO, true, false or nil
+ * io.wait -> IO, true or nil
+ * io.wait(timeout) -> IO, true or nil
+ * io.wait_readable -> IO, true or nil
+ * io.wait_readable(timeout) -> IO, true or nil
*
- * Waits until input is available or times out and returns self or nil when
- * EOF is reached.
+ * Waits until IO is readable without blocking and returns +self+, or
+ * +nil+ when times out.
+ * Returns +true+ immediately when buffered data is available.
*/
static VALUE
@@ -138,10 +139,7 @@ io_wait_readable(int argc, VALUE *argv, VALUE io)
tv = get_timeout(argc, argv, &timerec);
if (rb_io_read_pending(fptr)) return Qtrue;
if (wait_for_single_fd(fptr, RB_WAITFD_IN, tv)) {
- ioctl_arg n;
- if (!FIONREAD_POSSIBLE_P(fptr->fd)) return io;
- if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0);
- if (n > 0) return io;
+ return io;
}
return Qnil;
}