about summary refs log tree commit homepage
path: root/ext/unicorn_http/extconf.rb
diff options
context:
space:
mode:
authorEric Wong <bofh@yhbt.net>2023-06-11 22:41:21 +0000
committerEW <bofh@yhbt.net>2023-06-20 10:37:56 +0000
commit63c85c4282d15e22bd32a905883d2d0e149619d1 (patch)
tree3ebbb0afd042aa43da99a982b1a0b97a5540ff55 /ext/unicorn_http/extconf.rb
parentec30bf29ce5a37d7364c687bec05c8410375f2c9 (diff)
downloadunicorn-63c85c4282d15e22bd32a905883d2d0e149619d1.tar.gz
It looks like Ruby 3.3+ will hide rb_io_t internals and
get rid of the venerable `GetOpenFile' macro in favor of
`rb_io_descriptor'.  `rb_io_descriptor' has been public
API since Ruby 3.1 and should be safe to use, and
is necessary for `raindrops' (a dependency of ours):

  https://yhbt.net/raindrops-public/20230609104805.39022-1-samuel.williams@oriontransfer.co.nz/
  https://bugs.ruby-lang.org/issues/19057#note-17

We'll also avoid an unnecessary call to `rb_io_get_io' in
`get_readers' since `epio' (aka `self') can only be of
the Unicorn::Waiter IO subclass.  However, we must still use
`rb_io_get_io' when handling non-self args in `prep_readers'.
Diffstat (limited to 'ext/unicorn_http/extconf.rb')
-rw-r--r--ext/unicorn_http/extconf.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/unicorn_http/extconf.rb b/ext/unicorn_http/extconf.rb
index 80d00e5..11099cd 100644
--- a/ext/unicorn_http/extconf.rb
+++ b/ext/unicorn_http/extconf.rb
@@ -33,5 +33,7 @@ else
   message("no, needs Ruby 2.6+\n")
 end
 
-have_func('epoll_create1', %w(sys/epoll.h))
+if have_func('epoll_create1', %w(sys/epoll.h))
+  have_func('rb_io_descriptor') # Ruby 3.1+
+end
 create_makefile("unicorn_http")