<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Le 14 mars 09 à 16:19, Vadim Lebedev a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Le 14 mars 09 à 10:14, Russell Bryant a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Mar 13, 2009, at 6:13 PM, Vadim Lebedev wrote:<br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">Le 11 mars 09 à 02:01, Russell Bryant a écrit :<br></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">This is a known issue. It appears to be a bug with poll() / select()<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">on OSX. See the following bug report for details:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><a href="http://bugs.digium.com/view.php?id=13404">http://bugs.digium.com/view.php?id=13404</a><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I did some more debugging and see extremely strange stuff:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">main/poll.c is built and linked with the application,<br></blockquote><blockquote type="cite">but when asterisk calls poll it goes straight to the original <br></blockquote><blockquote type="cite">syscall...<br></blockquote><br>How did you go about determining that this was happening? Did you add <br>some logging into the internal poll() or something? It seems quite <br>strange that it would behave this way, indeed!<br><br></div></blockquote><div><br></div><div><br></div><div><br></div><div>Well, first of all i've tried set a breakpoint at poll.</div><div>The breakpoint was installde but NEVER hit.</div><div><br></div><div>So i've did following:</div><div><div>(gdb) disass</div><div>Dump of assembler code for function ast_el_read_char:</div><div>0x0001a43c <ast_el_read_char+0>:<span class="Apple-tab-span" style="white-space:pre">        </span>push %ebp</div><div>0x0001a43d <ast_el_read_char+1>:<span class="Apple-tab-span" style="white-space:pre">        </span>mov %esp,%ebp</div><div>0x0001a43f <ast_el_read_char+3>:<span class="Apple-tab-span" style="white-space:pre">        </span>push %edi</div><div>0x0001a440 <ast_el_read_char+4>:<span class="Apple-tab-span" style="white-space:pre">        </span>push %esi</div><div>0x0001a441 <ast_el_read_char+5>:<span class="Apple-tab-span" style="white-space:pre">        </span>push %ebx</div><div>0x0001a442 <ast_el_read_char+6>:<span class="Apple-tab-span" style="white-space:pre">        </span>sub $0x23c,%esp</div><div>0x0001a448 <ast_el_read_char+12>:<span class="Apple-tab-span" style="white-space:pre">        </span>call 0x1a44d <ast_el_read_char+17></div><div>0x0001a44d <ast_el_read_char+17>:<span class="Apple-tab-span" style="white-space:pre">        </span>pop %ebx</div><div>0x0001a44e <ast_el_read_char+18>:<span class="Apple-tab-span" style="white-space:pre">        </span>movl $0x0,-0x230(%ebp)</div><div>0x0001a458 <ast_el_read_char+28>:<span class="Apple-tab-span" style="white-space:pre">        </span>mov 0x11b10f(%ebx),%edx</div><div>0x0001a45e <ast_el_read_char+34>:<span class="Apple-tab-span" style="white-space:pre">        </span>lea -0x28(%ebp),%eax</div><div>0x0001a461 <ast_el_read_char+37>:<span class="Apple-tab-span" style="white-space:pre">        </span>mov %eax,-0x238(%ebp)</div><div>0x0001a467 <ast_el_read_char+43>:<span class="Apple-tab-span" style="white-space:pre">        </span>lea -0x228(%ebp),%eax</div><div>0x0001a46d <ast_el_read_char+49>:<span class="Apple-tab-span" style="white-space:pre">        </span>mov %eax,-0x23c(%ebp)</div><div>0x0001a473 <ast_el_read_char+55>:<span class="Apple-tab-span" style="white-space:pre">        </span>nop </div><div>0x0001a474 <ast_el_read_char+56>:<span class="Apple-tab-span" style="white-space:pre">        </span>mov 0x11c53b(%ebx),%eax</div><div>0x0001a47a <ast_el_read_char+62>:<span class="Apple-tab-span" style="white-space:pre">        </span>mov %eax,-0x28(%ebp)</div><div>0x0001a47d <ast_el_read_char+65>:<span class="Apple-tab-span" style="white-space:pre">        </span>movw $0x1,-0x24(%ebp)</div><div>0x0001a483 <ast_el_read_char+71>:<span class="Apple-tab-span" style="white-space:pre">        </span>test %dl,%dl</div><div>0x0001a485 <ast_el_read_char+73>:<span class="Apple-tab-span" style="white-space:pre">        </span>jns 0x1a5cc <ast_el_read_char+400></div><div>0x0001a48b <ast_el_read_char+79>:<span class="Apple-tab-span" style="white-space:pre">        </span>mov $0x1,%eax</div><div>0x0001a490 <ast_el_read_char+84>:<span class="Apple-tab-span" style="white-space:pre">        </span>push %esi</div><div>0x0001a491 <ast_el_read_char+85>:<span class="Apple-tab-span" style="white-space:pre">        </span>push $0xffffffff</div><div>0x0001a493 <ast_el_read_char+87>:<span class="Apple-tab-span" style="white-space:pre">        </span>push %eax</div><div>0x0001a494 <ast_el_read_char+88>:<span class="Apple-tab-span" style="white-space:pre">        </span>pushl -0x238(%ebp)</div><div><b><font class="Apple-style-span" color="#FF2822">0x0001a49a <ast_el_read_char+94>:</font></b><span class="Apple-tab-span" style="white-space:pre"><b><font class="Apple-style-span" color="#FF2822">        </font></b></span><b><font class="Apple-style-span" color="#FF2822">call 0x15452b <dyld_stub_poll$UNIX2003></font></b></div><div>0x0001a49f <ast_el_read_char+99>:<span class="Apple-tab-span" style="white-space:pre">        </span>add $0x10,%esp</div><div>0x0001a4a2 <ast_el_read_char+102>:<span class="Apple-tab-span" style="white-space:pre">        </span>test %eax,%eax</div><div>0x0001a4a4 <ast_el_read_char+104>:<span class="Apple-tab-span" style="white-space:pre">        </span>js 0x1a5f8 <ast_el_read_char+444></div><div>0x0001a4aa <ast_el_read_char+110>:<span class="Apple-tab-span" style="white-space:pre">        </span>mov 0x11b10f(%ebx),%edx</div><div>0x0001a4b0 <ast_el_read_char+116>:<span class="Apple-tab-span" style="white-space:pre">        </span>test %dl,%dl</div><div>0x0001a4b2 <ast_el_read_char+118>:<span class="Apple-tab-span" style="white-space:pre">        </span>js 0x1a4bf <ast_el_read_char+131></div><div>0x0001a4b4 <ast_el_read_char+120>:<span class="Apple-tab-span" style="white-space:pre">        </span>cmpw $0x0,-0x1a(%ebp)</div><div>0x0001a4b9 <ast_el_read_char+125>:<span class="Apple-tab-span" style="white-space:pre">        </span>jne 0x1a7e0 <ast_el_read_char+932></div><div>0x0001a4bf <ast_el_read_char+131>:<span class="Apple-tab-span" style="white-space:pre">        </span>cmpw $0x0,-0x22(%ebp)</div><div>0x0001a4c4 <ast_el_read_char+136>:<span class="Apple-tab-span" style="white-space:pre">        </span>je 0x1a474 <ast_el_read_char+56></div><div>0x0001a4c6 <ast_el_read_char+138>:<span class="Apple-tab-span" style="white-space:pre">        </span>push %esi</div><div>0x0001a4c7 <ast_el_read_char+139>:<span class="Apple-tab-span" style="white-space:pre">        </span>push $0x1ff</div><div>0x0001a4cc <ast_el_read_char+144>:<span class="Apple-tab-span" style="white-space:pre">        </span>pushl -0x23c(%ebp)</div><div>0x000</div></div><div><br></div><div><br></div></div></div></blockquote><br></div><div>This quick and dirty patch seems to solve the issue...</div><div>Another way to do it may be to compile main/poll.c as shared lib and use <span class="Apple-style-span" style="font-family: verdana; font-size: 13px; ">DYLD_INSERT_LIBRARIES mechanism (equivalent of LD_PRELOAD)</span></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;">Thanks</span></font></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;">Vadim</span></font></div><div><font class="Apple-style-span" face="verdana" size="3"><span class="Apple-style-span" style="font-size: 13px;"><br></span></font></div></body></html>