diff options
author | Mark Spencer <markster@digium.com> | 2004-04-25 20:42:45 +0000 |
---|---|---|
committer | Mark Spencer <markster@digium.com> | 2004-04-25 20:42:45 +0000 |
commit | 435e55958fb4b3421b996ea8af179be8ba37b0f8 (patch) | |
tree | 0520b52676690d8c020be12e27ae76e465d192fc /include | |
parent | 0eca3cf3846f515d929eb2fa22ed7da972f51e26 (diff) |
Properly migrate from select to poll for core asterisk.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2760 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rwxr-xr-x | include/asterisk/channel.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index aea8cbc1d..ef1d84756 100755 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -20,6 +20,7 @@ #include <unistd.h> #include <setjmp.h> #include <pthread.h> +#include <sys/poll.h> #if defined(__cplusplus) || defined(c_plusplus) extern "C" { @@ -781,6 +782,21 @@ int ast_do_masquerade(struct ast_channel *chan); /* Misc. functions below */ +/* Helper function for migrating select to poll */ +static inline int ast_fdisset(struct pollfd *pfds, int fd, int max, int *start) +{ + int x; + for (x=start ? *start : 0;x<max;x++) + if (pfds[x].fd == fd) { + if (start) { + if (x==*start) + (*start)++; + } + return pfds[x].revents; + } + return 0; +} + //! Waits for activity on a group of channels /*! * \param nfds the maximum number of file descriptors in the sets |