summaryrefslogtreecommitdiff
path: root/ext/io/wait/wait.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-17 04:47:38 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-07-17 04:47:38 +0000
commit0ede90588e04c05e33b0648ae957c1389cff6ab7 (patch)
tree54e9163cdaad71c23ff8d2e1c35346def030cdea /ext/io/wait/wait.c
parent01bf1f1e55e88dd9432090185d129d8df895850b (diff)
* ext/io/wait/extconf.rb, ext/io/wait/wait.c: Win32 platforms support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/io/wait/wait.c')
-rw-r--r--ext/io/wait/wait.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c
index 53d5bd7d182..41ba052850e 100644
--- a/ext/io/wait/wait.c
+++ b/ext/io/wait/wait.c
@@ -15,7 +15,17 @@
#include "rubyio.h"
#include <sys/types.h>
+#if defined(FIONREAD_HEADER)
#include FIONREAD_HEADER
+#elif defined(HAVE_RB_W32_IOCTLSOCKET)
+#define ioctl ioctlsocket
+#endif
+
+#ifdef HAVE_RB_W32_IS_SOCKET
+#define FIONREAD_POSSIBLE_P(fd) rb_w32_is_socket(fptr->fd)
+#else
+#define FIONREAD_POSSIBLE_P(fd) Qtrue
+#endif
static VALUE io_ready_p _((VALUE io));
static VALUE io_wait _((int argc, VALUE *argv, VALUE io));
@@ -45,6 +55,7 @@ io_ready_p(io)
GetOpenFile(io, fptr);
rb_io_check_readable(fptr);
+ if (!FIONREAD_POSSIBLE_P(fptr->fd)) return Qfalse;
fp = fptr->f;
if (feof(fp)) return Qfalse;
if (rb_read_pending(fp)) return Qtrue;
@@ -98,6 +109,7 @@ io_wait(argc, argv, io)
return Qnil;
}
+ if (!FIONREAD_POSSIBLE_P(fptr->fd)) return Qfalse;
void
Init_wait()
{