[asterisk-dev] [Code Review] Ensure internal poll is used when we ask for it

vadim at mbdsys.com vadim at mbdsys.com
Tue Mar 17 08:39:28 CDT 2009


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.digium.com/r/198/#review557
-----------------------------------------------------------

Ship it!


- vadim


On 2009-03-17 07:33:03, Russell Bryant wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.digium.com/r/198/
> -----------------------------------------------------------
> 
> (Updated 2009-03-17 07:33:03)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> We have seen a number of problems caused by poll() not working properly on Mac OSX.  If you search around, you'll find a number of references to using select() instead of poll() to work around these issues.  In Asterisk, we've had poll.c which implements poll() using select() internally.  However, we were still getting reports of problems.
> 
> vadim investigated a bit and realized that at least on his system, even though we were compiling in poll.o, the system poll() was still being used.  So, the primary purpose of this patch is to ensure that we're using the internal poll() when we want it to be used.
> 
> The changes are:
> 
> 1) Remove logic for when internal poll should be used from the Makefile.  Instead, put it in the configure script.  The logic in the configure script is the same as it was in the Makefile.  Ideally, we would have a functionality test for the problem, but that's not actually possible, since we would have to be able to run an application on the _target_ system to test poll() behavior.
> 
> 2) Always include poll.o in the build, but it will be empty if AST_POLL_COMPAT is not defined.
> 
> 3) Change uses of poll() throughout the source tree to ast_poll().  I feel that it is good practice to give the API call a new name when we are changing its behavior and not using the system version directly in all cases.  So, normally, ast_poll() is just redefined to poll().  On systems where AST_POLL_COMPAT is defined, ast_poll() is redefined to ast_internal_poll().
> 
> 4) Change poll() in main/poll.c to be ast_internal_poll().
> 
> It's worth noting that any code that still uses poll() directly will work fine (if they worked fine before).  So, for example, out of tree modules that are using poll() will not stop working or anything.  However, for modules to work properly on Mac OSX, ast_poll() needs to be used.
> 
> 
> This addresses bug 13404.
>     http://bugs.digium.com/view.php?id=13404
> 
> 
> Diffs
> -----
> 
>   /branches/1.4/apps/app_mp3.c 182520 
>   /branches/1.4/apps/app_nbscat.c 182520 
>   /branches/1.4/channels/chan_skinny.c 182520 
>   /branches/1.4/configure.ac 182520 
>   /branches/1.4/include/asterisk/autoconfig.h.in 182520 
>   /branches/1.4/include/asterisk/channel.h 182520 
>   /branches/1.4/include/asterisk/io.h 182520 
>   /branches/1.4/include/asterisk/poll-compat.h 182520 
>   /branches/1.4/main/Makefile 182520 
>   /branches/1.4/main/asterisk.c 182520 
>   /branches/1.4/main/channel.c 182520 
>   /branches/1.4/main/io.c 182520 
>   /branches/1.4/main/manager.c 182520 
>   /branches/1.4/main/poll.c 182520 
>   /branches/1.4/main/utils.c 182520 
>   /branches/1.4/res/res_agi.c 182520 
> 
> Diff: http://reviewboard.digium.com/r/198/diff
> 
> 
> Testing
> -------
> 
> I can not reproduce the poll() problems on my current mac laptop, but I did verify that the code compiles with AST_POLL_COMPAT defined and not defined.  I also verified that when it is defined on my mac, that asterisk -r still worked.
> 
> Also, vadim on issue #13404 tested the patch and verified that it fixed the problem for him.
> 
> 
> Thanks,
> 
> Russell
> 
>




More information about the asterisk-dev mailing list