poll() is totally broken on Mac OS X

Even on 10.5.8, poll() does not do the right thing. Haven't checked on
newer versions. Hence, wrap all occurences of poll() to pa_poll and
emulate that call with select() on OSX. This is totally embarassing.
This commit is contained in:
Daniel Mack 2009-11-23 00:12:18 +01:00
parent 962164a3b7
commit 17d34462ea
12 changed files with 34 additions and 40 deletions

View file

@ -43,13 +43,18 @@
#include "winsock.h"
#ifndef HAVE_POLL_H
#include <pulsecore/core-util.h>
#include <pulse/util.h>
#include "poll.h"
int poll (struct pollfd *fds, unsigned long int nfds, int timeout) {
/* Mac OSX fails to implement poll() in a working way since 10.4. IOW, for
* several years. We need to enable a dirty workaround and emulate that call
* with select(), just like for Windows. sic! */
#if !defined(HAVE_POLL_H) || defined(OS_IS_DARWIN)
int pa_poll (struct pollfd *fds, unsigned long int nfds, int timeout) {
struct timeval tv;
fd_set rset, wset, xset;
struct pollfd *f;