diff options
-rw-r--r-- | ext/kgio/extconf.rb | 1 | ||||
-rw-r--r-- | ext/kgio/kgio.h | 3 | ||||
-rw-r--r-- | ext/kgio/sock_for_fd.h | 4 |
3 files changed, 7 insertions, 1 deletions
diff --git a/ext/kgio/extconf.rb b/ext/kgio/extconf.rb index 7907ba3..a76454d 100644 --- a/ext/kgio/extconf.rb +++ b/ext/kgio/extconf.rb @@ -41,6 +41,7 @@ have_type("struct RFile", rubyio) and check_sizeof("struct RFile", rubyio) have_type("struct RObject") and check_sizeof("struct RObject") check_sizeof("int") have_func('rb_io_ascii8bit_binmode') +have_func('rb_update_max_fd') have_func('rb_thread_blocking_region') have_func('rb_thread_io_blocking_region') have_func('rb_str_set_len') diff --git a/ext/kgio/kgio.h b/ext/kgio/kgio.h index 8e4d698..fcdf0fe 100644 --- a/ext/kgio/kgio.h +++ b/ext/kgio/kgio.h @@ -46,4 +46,7 @@ VALUE kgio_call_wait_readable(VALUE io); # define USE_KGIO_POLL #endif /* USE_KGIO_POLL */ +#ifndef HAVE_RB_UPDATE_MAX_FD +# define rb_update_max_fd(fd) for (;0;) +#endif #endif /* KGIO_H */ diff --git a/ext/kgio/sock_for_fd.h b/ext/kgio/sock_for_fd.h index 52947d9..55f9ccb 100644 --- a/ext/kgio/sock_for_fd.h +++ b/ext/kgio/sock_for_fd.h @@ -29,9 +29,11 @@ #if SOCK_FOR_FD == 19 /* modeled after ext/socket/init.c */ static VALUE sock_for_fd(VALUE klass, int fd) { - VALUE sock = rb_obj_alloc(klass); + VALUE sock; rb_io_t *fp; + rb_update_max_fd(fd); /* 1.9.3+ API */ + sock = rb_obj_alloc(klass); MakeOpenFile(sock, fp); fp->fd = fd; fp->mode = FMODE_READWRITE|FMODE_DUPLEX|FMODE_NOREVLOOKUP; |