[前][次][番号順一覧][スレッド一覧]

ruby-changes:46567

From: usa <ko1@a...>
Date: Fri, 12 May 2017 19:05:56 +0900 (JST)
Subject: [ruby-changes:46567] usa:r58682 (trunk): Support bulding the extension on Windows

usa	2017-05-12 19:05:48 +0900 (Fri, 12 May 2017)

  New Revision: 58682

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58682

  Log:
    Support bulding the extension on Windows

  Modified files:
    trunk/spec/rubyspec/optional/capi/ext/io_spec.c
Index: spec/rubyspec/optional/capi/ext/io_spec.c
===================================================================
--- spec/rubyspec/optional/capi/ext/io_spec.c	(revision 58681)
+++ spec/rubyspec/optional/capi/ext/io_spec.c	(revision 58682)
@@ -2,7 +2,9 @@ https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/optional/capi/ext/io_spec.c#L2
 #include "rubyspec.h"
 #include "ruby/io.h"
 #include <fcntl.h>
+#if HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -10,13 +12,16 @@ extern "C" { https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/optional/capi/ext/io_spec.c#L12
 
 static int set_non_blocking(int fd) {
   int flags;
-#if defined(O_NONBLOCK)
+#if defined(O_NONBLOCK) && defined(F_GETFL)
   if (-1 == (flags = fcntl(fd, F_GETFL, 0)))
     flags = 0;
   return fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-#else
+#elif defined(FIOBIO)
   flags = 1;
   return ioctl(fd, FIOBIO, &flags);
+#else
+  errno = ENOSYS;
+  return -1;
 #endif
 }
 
@@ -139,7 +144,8 @@ VALUE io_spec_rb_io_wait_readable(VALUE https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/optional/capi/ext/io_spec.c#L144
   char buf[RB_IO_WAIT_READABLE_BUF];
   wait_bool ret;
 
-  set_non_blocking(fd);
+  if (set_non_blocking(fd) == -1)
+    rb_sys_fail(0);
 
   if(RTEST(read_p)) {
     rb_ivar_set(self, rb_intern("@write_data"), Qtrue);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]