From: "edelsohn (David Edelsohn)" Date: 2013-03-28T07:23:44+09:00 Subject: [ruby-core:53782] [ruby-trunk - Bug #8174] AIX header file conflict with rb_hook_list_struct Issue #8174 has been updated by edelsohn (David Edelsohn). I do not know why the documentation page that you referenced does not mention "events". The same header also exists in AIX 6.1, and probably earlier. It may have been removed in some update, but that does not address existing systems. Ruby thread.c uses revents: if (fds.revents & POLLIN_SET) result |= RB_WAITFD_IN; if (fds.revents & POLLOUT_SET) result |= RB_WAITFD_OUT; if (fds.revents & POLLEX_SET) result |= RB_WAITFD_PRI; so your patch causes the statements to refer to the wrong members. It seems safer to #undef the offending macro instead of defining more macros. Wrapping it in #ifdef _AIX is fine. diff --git i/include/ruby/io.h w/include/ruby/io.h index 07be55c..12ffc76 100644 --- i/include/ruby/io.h +++ w/include/ruby/io.h @@ -29,6 +29,9 @@ extern "C" { #include "ruby/config.h" #if defined(HAVE_POLL) +# ifdef _AIX +# undef events +# endif # include # define RB_WAITFD_IN POLLIN # define RB_WAITFD_PRI POLLPRI ---------------------------------------- Bug #8174: AIX header file conflict with rb_hook_list_struct https://bugs.ruby-lang.org/issues/8174#change-37975 Author: edelsohn (David Edelsohn) Status: Feedback Priority: Normal Assignee: Category: Target version: ruby -v: ruby-2.0.0-p0 =begin rb_hook_list_struct defines a member "events": typedef struct rb_hook_list_struct { struct rb_event_hook_struct *hooks; rb_event_flag_t events; int need_clean; } rb_hook_list_t; AIX defines a macro "events" in sys/poll.h: struct pollfd { long fd; /* file descriptor or file ptr */ ushort reqevents; /* requested events */ ushort rtnevents; /* returned events */ }; #define events reqevents /* SVR3,4 pollfd member name */ #define revents rtnevents /* SVR3,4 pollfd member name */ Ruby thread.c includes sys/poll.c via ruby/io.h. This renames the structure member when referenced through EXEC_EVENT_HOOK, e.g., if ((state = EXEC_TAG()) == 0) { SAVE_ROOT_JMPBUF(th, { if (!th->first_func) { GetProcPtr(th->first_proc, proc); th->errinfo = Qnil; th->root_lep = rb_vm_ep_local_ep(proc->block.ep); th->root_svar = Qnil; EXEC_EVENT_HOOK(th, RUBY_EVENT_THREAD_BEGIN, th->self, 0, 0, Qundef); th->value = rb_vm_invoke_proc(th, proc, (int)RARRAY_LEN(args), RARRAY_PTR(args), 0); EXEC_EVENT_HOOK(th, RUBY_EVENT_THREAD_END, th->self, 0, 0, Qundef); } This makes the compiler unhappy: compiling /usr/gnu/src/ruby-2.0.0-p0/thread.c /usr/gnu/src/ruby-2.0.0-p0/thread.c: In function 'thread_start_func_2': /usr/gnu/src/ruby-2.0.0-p0/thread.c:496:6: error: 'rb_hook_list_t' has no member named 'reqevents' /usr/gnu/src/ruby-2.0.0-p0/thread.c:496:6: error: 'rb_hook_list_t' has no member named 'reqevents' /usr/gnu/src/ruby-2.0.0-p0/thread.c:496:6: error: 'rb_hook_list_t' has no member named 'reqevents' /usr/gnu/src/ruby-2.0.0-p0/thread.c:496:6: error: 'rb_hook_list_t' has no member named 'reqevents' /usr/gnu/src/ruby-2.0.0-p0/thread.c: In function 'rb_threadptr_execute_interrupts': /usr/gnu/src/ruby-2.0.0-p0/thread.c:1917:6: error: 'rb_hook_list_t' has no member named 'reqevents' /usr/gnu/src/ruby-2.0.0-p0/thread.c:1917:6: error: 'rb_hook_list_t' has no member named 'reqevents' Because Ruby only uses fd member revents, one option is to change include/ruby/io.h # diff #include "ruby/config.h" #if defined(HAVE_POLL) # include +# undef events # define RB_WAITFD_IN POLLIN # define RB_WAITFD_PRI POLLPRI # define RB_WAITFD_OUT POLLOUT =end -- http://bugs.ruby-lang.org/