diff options
Diffstat (limited to 'dev-ruby/eventmachine/files/eventmachine-1.2.7-ruby3-process-status.patch')
| -rw-r--r-- | dev-ruby/eventmachine/files/eventmachine-1.2.7-ruby3-process-status.patch | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/dev-ruby/eventmachine/files/eventmachine-1.2.7-ruby3-process-status.patch b/dev-ruby/eventmachine/files/eventmachine-1.2.7-ruby3-process-status.patch deleted file mode 100644 index f836d3ff076e..000000000000 --- a/dev-ruby/eventmachine/files/eventmachine-1.2.7-ruby3-process-status.patch +++ /dev/null @@ -1,94 +0,0 @@ -From daeb121fb5600cc0f4fc604fbf7d742578f26483 Mon Sep 17 00:00:00 2001 -From: MSP-Greg <Greg.mpls@gmail.com> -Date: Sat, 12 Jun 2021 22:37:37 -0500 -Subject: [PATCH] Fixes for Process::Status changes in Ruby 3 - ---- - ext/extconf.rb | 3 +++ - ext/rubymain.cpp | 36 ++++++++++++++++++++++++++++++------ - 2 files changed, 33 insertions(+), 6 deletions(-) - -diff --git a/ext/extconf.rb b/ext/extconf.rb -index 0fb654104..ce83c0028 100644 ---- a/ext/extconf.rb -+++ b/ext/extconf.rb -@@ -138,6 +138,9 @@ def find_openssl_library - add_define "HAVE_KQUEUE" if have_header("sys/event.h") && have_header("sys/queue.h") - end - -+# Add for changes to Process::Status in Ruby 3 -+add_define("IS_RUBY_3_OR_LATER") if RUBY_VERSION > "3.0" -+ - # Adjust number of file descriptors (FD) on Windows - - if RbConfig::CONFIG["host_os"] =~ /mingw/ -diff --git a/ext/rubymain.cpp b/ext/rubymain.cpp -index 5da5c8b25..36018c63d 100644 ---- a/ext/rubymain.cpp -+++ b/ext/rubymain.cpp -@@ -85,7 +85,24 @@ static VALUE Intern_proxy_target_unbound; - static VALUE Intern_proxy_completed; - static VALUE Intern_connection_completed; - --static VALUE rb_cProcStatus; -+static VALUE rb_cProcessStatus; -+ -+#ifdef IS_RUBY_3_OR_LATER -+struct rb_process_status { -+ rb_pid_t pid; -+ int status; -+ int error; -+}; -+ -+static const rb_data_type_t rb_process_status_type = { -+ .wrap_struct_name = "Process::Status", -+ .function = { -+ .dfree = RUBY_DEFAULT_FREE, -+ }, -+ .data = NULL, -+ .flags = RUBY_TYPED_FREE_IMMEDIATELY, -+}; -+#endif - - struct em_event { - uintptr_t signature; -@@ -553,11 +570,18 @@ static VALUE t_get_subprocess_status (VALUE self UNUSED, VALUE signature) - - if (evma_get_subprocess_status (NUM2BSIG (signature), &status)) { - if (evma_get_subprocess_pid (NUM2BSIG (signature), &pid)) { -- proc_status = rb_obj_alloc(rb_cProcStatus); - -+#ifdef IS_RUBY_3_OR_LATER -+ struct rb_process_status *data = NULL; -+ proc_status = TypedData_Make_Struct(rb_cProcessStatus, struct rb_process_status, &rb_process_status_type, data); -+ data->pid = pid; -+ data->status = status; -+#else -+ proc_status = rb_obj_alloc(rb_cProcessStatus); - /* MRI Ruby uses hidden instance vars */ -- rb_iv_set(proc_status, "status", INT2FIX(status)); -- rb_iv_set(proc_status, "pid", INT2FIX(pid)); -+ rb_ivar_set(proc_status, rb_intern_const("status"), INT2FIX(status)); -+ rb_ivar_set(proc_status, rb_intern_const("pid"), INT2FIX(pid)); -+#endif - - #ifdef RUBINIUS - /* Rubinius uses standard instance vars */ -@@ -572,7 +596,7 @@ static VALUE t_get_subprocess_status (VALUE self UNUSED, VALUE signature) - #endif - } - } -- -+ rb_obj_freeze(proc_status); - return proc_status; - } - -@@ -1431,7 +1455,7 @@ extern "C" void Init_rubyeventmachine() - { - // Lookup Process::Status for get_subprocess_status - VALUE rb_mProcess = rb_const_get(rb_cObject, rb_intern("Process")); -- rb_cProcStatus = rb_const_get(rb_mProcess, rb_intern("Status")); -+ rb_cProcessStatus = rb_const_get(rb_mProcess, rb_intern("Status")); - - // Tuck away some symbol values so we don't have to look 'em up every time we need 'em. - Intern_at_signature = rb_intern ("@signature"); |
