mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/io/wait/extconf.rb, ext/io/wait/wait.c: Win32 platforms support.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									c3f7f78a5f
								
							
						
					
					
						commit
						3db45ca3cc
					
				
					 3 changed files with 22 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1,3 +1,7 @@
 | 
			
		|||
Sun Jul 17 13:46:54 2005  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* ext/io/wait/extconf.rb, ext/io/wait/wait.c: Win32 platforms support.
 | 
			
		||||
 | 
			
		||||
Sat Jul 16 23:43:16 2005  Nobuyoshi Nakada  <nobu@ruby-lang.org>
 | 
			
		||||
 | 
			
		||||
	* enumerator.c (Init_Enumerator): wrong argument specs.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,10 +3,15 @@ target = "io/wait"
 | 
			
		|||
 | 
			
		||||
unless macro_defined?("DOSISH", "#include <ruby.h>")
 | 
			
		||||
  fionread = %w[sys/ioctl.h sys/filio.h].find do |h|
 | 
			
		||||
    checking_for("FIONREAD") {macro_defined?("FIONREAD", "#include <#{h}>\n")}
 | 
			
		||||
    checking_for("FIONREAD") {have_macro("FIONREAD", h)}
 | 
			
		||||
  end
 | 
			
		||||
  if fionread
 | 
			
		||||
    $defs << "-DFIONREAD_HEADER=\"<#{fionread}>\""
 | 
			
		||||
    create_makefile(target)
 | 
			
		||||
  end
 | 
			
		||||
else
 | 
			
		||||
  if have_func("rb_w32_ioctlsocket", "ruby.h")
 | 
			
		||||
    have_func("rb_w32_is_socket", "ruby.h")
 | 
			
		||||
    create_makefile(target)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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 (rb_io_read_pending(fptr)) return Qtrue;
 | 
			
		||||
    if (!FIONREAD_POSSIBLE_P(fptr->fd)) return Qfalse;
 | 
			
		||||
    if (ioctl(fptr->fd, FIONREAD, &n)) rb_sys_fail(0);
 | 
			
		||||
    if (n > 0) return INT2NUM(n);
 | 
			
		||||
    return Qnil;
 | 
			
		||||
| 
						 | 
				
			
			@ -98,6 +109,7 @@ io_wait(argc, argv, io)
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    if (rb_io_read_pending(fptr)) return Qtrue;
 | 
			
		||||
    if (!FIONREAD_POSSIBLE_P(fptr->fd)) return Qfalse;
 | 
			
		||||
    fd = fptr->fd;
 | 
			
		||||
    rb_fd_init(&arg.fds);
 | 
			
		||||
    rb_fd_set(fd, &arg.fds);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue