https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112013-03-27T15:28:51ZRuby Issue Tracking SystemBackport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=379632013-03-27T15:28:51Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/37963/diff?detail_id=27360">diff</a>)</li><li><strong>Status</strong> changed from <i>Open</i> to <i>Feedback</i></li></ul><p>=begin<br>
reqevents and rtnevents names are not mentioned in ((<a href="URL:http://pic.dhe.ibm.com/infocenter/aix/v7r1/topic/com.ibm.aix.basetechref/doc/basetrf1/poll.htm" class="external">URL:http://pic.dhe.ibm.com/infocenter/aix/v7r1/topic/com.ibm.aix.basetechref/doc/basetrf1/poll.htm</a>)).</p>
<p>Is this page old?</p>
<p>What about this patch?</p>
<p>diff --git i/include/ruby/io.h w/include/ruby/io.h<br>
index 07be55c..12ffc76 100644<br>
--- i/include/ruby/io.h<br>
+++ w/include/ruby/io.h<br>
@@ -29,6 +29,10 @@ extern "C" {</p>
<p>#include "ruby/config.h"<br>
#if defined(HAVE_POLL)<br>
+# ifdef _AIX<br>
+# define reqevents events<br>
+# define rtnevents revents<br>
+# endif</p>
<a name="include-ltpollhgt"></a>
<h1 >include <poll.h><a href="#include-ltpollhgt" class="wiki-anchor">¶</a></h1>
<a name="define-RB_WAITFD_IN-POLLIN"></a>
<h1 >define RB_WAITFD_IN POLLIN<a href="#define-RB_WAITFD_IN-POLLIN" class="wiki-anchor">¶</a></h1>
<a name="define-RB_WAITFD_PRI-POLLPRI"></a>
<h1 >define RB_WAITFD_PRI POLLPRI<a href="#define-RB_WAITFD_PRI-POLLPRI" class="wiki-anchor">¶</a></h1>
<p>=end</p> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=379752013-03-28T07:23:44Zedelsohn (David Edelsohn)dje.gcc@gmail.com
<ul></ul><p>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.</p>
<p>Ruby thread.c uses revents:</p>
<pre><code>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;
</code></pre>
<p>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.</p>
<p>diff --git i/include/ruby/io.h w/include/ruby/io.h<br>
index 07be55c..12ffc76 100644<br>
--- i/include/ruby/io.h<br>
+++ w/include/ruby/io.h<br>
@@ -29,6 +29,9 @@ extern "C" {</p>
<p>#include "ruby/config.h"<br>
#if defined(HAVE_POLL)<br>
+# ifdef _AIX<br>
+# undef events<br>
+# endif</p>
<a name="include-ltpollhgt"></a>
<h1 >include <poll.h><a href="#include-ltpollhgt" class="wiki-anchor">¶</a></h1>
<a name="define-RB_WAITFD_IN-POLLIN"></a>
<h1 >define RB_WAITFD_IN POLLIN<a href="#define-RB_WAITFD_IN-POLLIN" class="wiki-anchor">¶</a></h1>
<a name="define-RB_WAITFD_PRI-POLLPRI"></a>
<h1 >define RB_WAITFD_PRI POLLPRI<a href="#define-RB_WAITFD_PRI-POLLPRI" class="wiki-anchor">¶</a></h1> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=379772013-03-28T07:51:18Zedelsohn (David Edelsohn)dje.gcc@gmail.com
<ul></ul><p>Unfortunately this fix no longer will work with Ruby trunk because thread_pthread.c added references to "events":</p>
<pre><code>pollfds[0].fd = timer_thread_pipe[0];
pollfds[0].events = POLLIN;
pollfds[1].fd = timer_thread_pipe_low[0];
pollfds[1].events = POLLIN;
</code></pre> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=379822013-03-28T09:18:48Zkosaki (Motohiro KOSAKI)kosaki.motohiro@gmail.com
<ul></ul><p>So, I suspect AIX need to undefine HAVE_POLL. i.e. need some configure.in magic.</p> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380002013-03-28T22:27:56Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>=begin<br>
I could reproduce the error by copying system ((%sys/poll.h%)) header to<br>
((%include/poll.h%)) with editing like the AIX header. And by adding these<br>
two lines just before (({#include <poll.h>})) line in ((%include/ruby/io.h%)), it<br>
builds fine.</p>
<a name="define-reqevents-events"></a>
<h1 >define reqevents events<a href="#define-reqevents-events" class="wiki-anchor">¶</a></h1>
<a name="define-rtnevents-revents"></a>
<h1 >define rtnevents revents<a href="#define-rtnevents-revents" class="wiki-anchor">¶</a></h1>
<p>=end</p> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380022013-03-28T23:05:37Zedelsohn (David Edelsohn)dje.gcc@gmail.com
<ul></ul><p>Sorry Nakada-san. I misinterpreted your proposed fix. Yes, inserting those definitions <em>before</em> including poll.h allows thread.c to compile successfully.</p> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380042013-03-28T23:10:24Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Feedback</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>This issue was solved with changeset r39987.<br>
David, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>ruby/io.h: get rid of conflict on AIX</p>
<ul>
<li>include/ruby/io.h: rename SVR3,4 member names as POSIX compliants,<br>
to get rid of conflict on AIX. <a href="/issues/8174">[ruby-core:53765]</a> [Bug <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: AIX header file conflict with rb_hook_list_struct (Closed)" href="https://bugs.ruby-lang.org/issues/8174">#8174</a>]</li>
</ul> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380062013-03-28T23:13:57Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Backport</i></li><li><strong>Project</strong> changed from <i>Ruby master</i> to <i>Backport200</i></li><li><strong>Status</strong> changed from <i>Closed</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>nagachika (Tomoyuki Chikanaga)</i></li></ul> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380122013-03-29T03:06:25Zedelsohn (David Edelsohn)dje.gcc@gmail.com
<ul></ul><p>Nakada-san, The patch checked in to ruby-trunk was not the same as the one that you proposed. The patch #undefs the macros after including poll.h.</p>
<a name="ifdef-_AIX"></a>
<h1 >ifdef _AIX<a href="#ifdef-_AIX" class="wiki-anchor">¶</a></h1>
<a name="define-reqevents-events"></a>
<h1 >define reqevents events<a href="#define-reqevents-events" class="wiki-anchor">¶</a></h1>
<a name="define-rtnevents-revents"></a>
<h1 >define rtnevents revents<a href="#define-rtnevents-revents" class="wiki-anchor">¶</a></h1>
<a name="endif"></a>
<h1 >endif<a href="#endif" class="wiki-anchor">¶</a></h1>
<a name="include-ltpollhgt"></a>
<h1 >include <poll.h><a href="#include-ltpollhgt" class="wiki-anchor">¶</a></h1>
<a name="ifdef-_AIX-2"></a>
<h1 >ifdef _AIX<a href="#ifdef-_AIX-2" class="wiki-anchor">¶</a></h1>
<a name="undef-reqevents"></a>
<h1 >undef reqevents<a href="#undef-reqevents" class="wiki-anchor">¶</a></h1>
<a name="undef-rtnevents"></a>
<h1 >undef rtnevents<a href="#undef-rtnevents" class="wiki-anchor">¶</a></h1>
<a name="endif-2"></a>
<h1 >endif<a href="#endif-2" class="wiki-anchor">¶</a></h1>
<p>With changeset r39987, AIX remains broken.</p>
<p>Your original patch redefined the identifiers throughout the entire file. The committed patch exchanges some names within poll.h but does not satisfy identifiers used within thread.c</p>
<p>With the original proposed patch, thread.i looks like:</p>
<p>struct pollfd<br>
{<br>
long fd;<br>
ushort events;<br>
ushort revents;<br>
};<br>
#define events reqevents<br>
#define revents rtnevents</p>
<pre><code>pollfds[0].fd = timer_thread_pipe[0];
pollfds[0].events = 0x0001;
pollfds[1].fd = timer_thread_pipe_low[0];
pollfds[1].events = 0x0001;
</code></pre>
<p>do { rb_thread_t * const _th = (th); struct rb_vm_tag _tag; _tag.tag = 0; _tag.<br>
prev = _th->tag; _th->tag = &_tag;;<br>
if ((state = _setjmp(_th->tag->buf)) == 0) {<br>
do if (_setjmp((th)->root_jmpbuf) == 0) { { if (!th->first_func) { do { ((p<br>
roc)) = (rb_proc_t*)(((struct RData*)((th->first_proc)))->data); } while (0); th<br>
->errinfo = ((VALUE)RUBY_Qnil); th->root_lep = rb_vm_ep_local_ep(proc->block.ep)<br>
; th->root_svar = ((VALUE)RUBY_Qnil); do { if ((<em><em>builtin_expect((ruby_vm_event</em><br>
flags & (0x0400)), 0))) { if (((th)->event_hooks.events | (th)->vm->event_hooks.<br>
events) & (0x0400)) { struct rb_trace_arg_struct trace_arg; trace_arg.event = (0<br>
x0400); trace_arg.th = (th); trace_arg.cfp = (trace_arg.th)->cfp; trace_arg.self<br>
= (th->self); trace_arg.id = (0); trace_arg.klass = (0); trace_arg.data = (((VA<br>
LUE)RUBY_Qundef)); trace_arg.path = ((VALUE)RUBY_Qundef); trace_arg.klass_solved<br>
= 0; if (0) rb_threadptr_exec_event_hooks_and_pop_frame(&trace_arg); else rb_th<br>
readptr_exec_event_hooks(&trace_arg); } } } while (0); th->value = rb_vm_invoke</em><br>
proc(th, proc, (int)((((struct RBasic*)(args))->flags & (((VALUE)1)<<(12 +1))) ?<br>
(long)((((struct RBasic*)(args))->flags >> (12 +3)) & (((((VALUE)1)<<(12 +4))|(<br>
((VALUE)1)<<(12 +3))) >> (12 +3))) : ((struct RArray*)(args))->as.heap.len), (((<br>
(struct RBasic*)(args))->flags & (((VALUE)1)<<(12 +1))) ? ((struct RArray*)(args<br>
))->as.ary : ((struct RArray*)(args))->as.heap.ptr), 0); do { if ((__builtin_exp<br>
ect((ruby_vm_event_flags & (0x0800)), 0))) { if (((th)->event_hooks.events | (th<br>
)->vm->event_hooks.events) & (0x0800)) { struct rb_trace_arg_struct trace_arg; t<br>
race_arg.event = (0x0800); trace_arg.th = (th); trace_arg.cfp = (trace_arg.th)-><br>
cfp; trace_arg.self = (th->self); trace_arg.id = (0); trace_arg.klass = (0); tra<br>
ce_arg.data = (((VALUE)RUBY_Qundef)); trace_arg.path = ((VALUE)RUBY_Qundef); tra<br>
ce_arg.klass_solved = 0; if (0) rb_threadptr_exec_event_hooks_and_pop_frame(&tra<br>
ce_arg); else rb_threadptr_exec_event_hooks(&trace_arg); } } } while (0); } else<br>
{ th->value = (*th->first_func)((void *)args); } }; } else { rb_fiber_start();<br>
} while (0)</p>
<p>because the pollfd struct declaration is affected in the header to use the correct member names directly.</p>
<p>With the current sources, the pollfd struct declaration is modifier, but the rest of the file uses the wrong member names:</p>
<p>struct pollfd<br>
{<br>
long fd;<br>
ushort events;<br>
ushort revents;<br>
};<br>
#define events reqevents<br>
#define revents rtnevents</p>
<p>#undef reqevents<br>
#undef rtnevents</p>
<pre><code>pollfds[0].fd = timer_thread_pipe[0];
pollfds[0].reqevents = 0x0001;
pollfds[1].fd = timer_thread_pipe_low[0];
pollfds[1].reqevents = 0x0001;
</code></pre>
<p>if ((state = _setjmp(_th->tag->buf)) == 0) {<br>
do if (_setjmp((th)->root_jmpbuf) == 0) { { if (!th->first_func) { do { ((p<br>
roc)) = (rb_proc_t*)(((struct RData*)((th->first_proc)))->data); } while (0); th<br>
->errinfo = ((VALUE)RUBY_Qnil); th->root_lep = rb_vm_ep_local_ep(proc->block.ep)<br>
; th->root_svar = ((VALUE)RUBY_Qnil); do { if ((<em><em>builtin_expect((ruby_vm_event</em><br>
flags & (0x0400)), 0))) { if (((th)->event_hooks.reqevents | (th)->vm->event_hoo<br>
ks.reqevents) & (0x0400)) { struct rb_trace_arg_struct trace_arg; trace_arg.even<br>
t = (0x0400); trace_arg.th = (th); trace_arg.cfp = (trace_arg.th)->cfp; trace_ar<br>
g.self = (th->self); trace_arg.id = (0); trace_arg.klass = (0); trace_arg.data =<br>
(((VALUE)RUBY_Qundef)); trace_arg.path = ((VALUE)RUBY_Qundef); trace_arg.klass</em><br>
solved = 0; if (0) rb_threadptr_exec_event_hooks_and_pop_frame(&trace_arg); else<br>
rb_threadptr_exec_event_hooks(&trace_arg); } } } while (0); th->value = rb_vm_i<br>
nvoke_proc(th, proc, (int)((((struct RBasic*)(args))->flags & (((VALUE)1)<<(12 +<br>
1))) ? (long)((((struct RBasic*)(args))->flags >> (12 +3)) & (((((VALUE)1)<<(12<br>
+4))|(((VALUE)1)<<(12 +3))) >> (12 +3))) : ((struct RArray*)(args))->as.heap.len<br>
), ((((struct RBasic*)(args))->flags & (((VALUE)1)<<(12 +1))) ? ((struct RArray*<br>
)(args))->as.ary : ((struct RArray*)(args))->as.heap.ptr), 0); do { if ((_<em>built<br>
in_expect((ruby_vm_event_flags & (0x0800)), 0))) { if (((th)->event_hooks.reqeve<br>
nts | (th)->vm->event_hooks.reqevents) & (0x0800)) { struct rb_trace_arg_struct<br>
trace_arg; trace_arg.event = (0x0800); trace_arg.th = (th); trace_arg.cfp = (tra<br>
ce_arg.th)->cfp; trace_arg.self = (th->self); trace_arg.id = (0); trace_arg.klas<br>
s = (0); trace_arg.data = (((VALUE)RUBY_Qundef)); trace_arg.path = ((VALUE)RUBY</em><br>
Qundef); trace_arg.klass_solved = 0; if (0) rb_threadptr_exec_event_hooks_and_po<br>
p_frame(&trace_arg); else rb_threadptr_exec_event_hooks(&trace_arg); } } } while<br>
(0); } else { th->value = (*th->first_func)((void *)args); } }; } else { rb_fib<br>
er_start(); } while (0)</p>
<p>and there is no member reqevents in struct pollfd.</p> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380172013-03-29T07:57:45Zedelsohn (David Edelsohn)dje.gcc@gmail.com
<ul></ul><p>Let me explain it this way:</p>
<p>Either io.h needs to leave the macro definitions for _AIX defined,</p>
<p><em>OR</em> io.h needs to undefine both the macro definitions that it created for _AIX <em>and</em> the macro definitions that the AIX sys/poll.h header defined.</p> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380202013-03-29T10:21:27Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Tracker</strong> changed from <i>Backport</i> to <i>Bug</i></li><li><strong>Project</strong> changed from <i>Backport200</i> to <i>Ruby master</i></li><li><strong>Assignee</strong> changed from <i>nagachika (Tomoyuki Chikanaga)</i> to <i>nobu (Nobuyoshi Nakada)</i></li></ul> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380212013-03-29T10:21:54Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>% Done</strong> changed from <i>100</i> to <i>50</i></li><li><strong>ruby -v</strong> set to <i>trunk</i></li></ul> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380222013-03-29T10:24:16Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li><li><strong>% Done</strong> changed from <i>50</i> to <i>100</i></li></ul><p>This issue was solved with changeset r39993.<br>
David, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>ruby/io.h: get rid of conflict on AIX</p>
<ul>
<li>include/ruby/io.h: undef POSIX compliants names on AIX, which are no<br>
longer needed. patch suggested by edelsohn (David Edelsohn) in<br>
<a href="/issues/8174">[ruby-core:53815]</a>. [Bug <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: AIX header file conflict with rb_hook_list_struct (Closed)" href="https://bugs.ruby-lang.org/issues/8174">#8174</a>]</li>
</ul> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380232013-03-29T10:25:04Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Backport</i></li><li><strong>Project</strong> changed from <i>Ruby master</i> to <i>Backport200</i></li><li><strong>Status</strong> changed from <i>Closed</i> to <i>Assigned</i></li><li><strong>Assignee</strong> changed from <i>nobu (Nobuyoshi Nakada)</i> to <i>nagachika (Tomoyuki Chikanaga)</i></li></ul> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=380312013-03-30T00:56:42Zedelsohn (David Edelsohn)dje.gcc@gmail.com
<ul></ul><p>Thank you, Nakada-san. ruby-trunk now builds on AIX. Testing only reports one error.</p>
<p>Who can I contact to set up buildbot CI testers and connect them to the testing infrastructure, such as rubyci.org?</p> Backport200 - Backport #8174: AIX header file conflict with rb_hook_list_structhttps://bugs.ruby-lang.org/issues/8174?journal_id=385482013-04-15T00:10:33Znagachika (Tomoyuki Chikanaga)nagachika00@gmail.com
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>This issue was solved with changeset r40292.<br>
David, thank you for reporting this issue.<br>
Your contribution to Ruby is greatly appreciated.<br>
May Ruby be with you.</p>
<hr>
<p>merge revision(s) 39987,39993,39998: [Backport <a class="issue tracker-4 status-5 priority-4 priority-default closed" title="Backport: AIX header file conflict with rb_hook_list_struct (Closed)" href="https://bugs.ruby-lang.org/issues/8174">#8174</a>]</p>
<pre><code>* include/ruby/io.h: rename SVR3,4 member names as POSIX compliants,
to get rid of conflict on AIX. <a href="/issues/8174">[ruby-core:53765]</a> [Bug #8174]
* include/ruby/io.h: undef POSIX compliants names on AIX, which are no
longer needed. patch suggested by edelsohn (David Edelsohn) in
<a href="/issues/8174">[ruby-core:53815]</a>. [Bug #8174]
* include/ruby/io.h: undef POSIX compliant names on AIX, which are no
* include/ruby/io.h: rename SVR3,4 member names as POSIX compliant,
</code></pre>