summaryrefslogtreecommitdiffstats
path: root/daemon
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2010-03-29 22:45:27 +0200
committerGravatar Hector Martin2010-04-08 15:11:28 +0200
commitc310eb77480ca24dfdeefd80b73318ef890b5e2a (patch)
treec1bbeb4d5db049aebf4ea9775f36a7d14363cbbc /daemon
parent3013889a86dff1fcc6260b476dc30824b71b0562 (diff)
downloadusbmuxd-c310eb77480ca24dfdeefd80b73318ef890b5e2a.tar.gz
usbmuxd-c310eb77480ca24dfdeefd80b73318ef890b5e2a.tar.bz2
OSX: add workaround for missing ppoll system call
Diffstat (limited to 'daemon')
-rw-r--r--daemon/main.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/daemon/main.c b/daemon/main.c
index 18b28a8..d8ae703 100644
--- a/daemon/main.c
+++ b/daemon/main.c
@@ -147,6 +147,21 @@ void set_signal_handlers(void)
sigaction(SIGUSR2, &sa, NULL);
}
+#ifdef __APPLE__
+static int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout, const sigset_t *sigmask)
+{
+ int ready;
+ sigset_t origmask;
+ int to = timeout->tv_sec*1000 + timeout->tv_nsec/1000000;
+
+ sigprocmask(SIG_SETMASK, sigmask, &origmask);
+ ready = poll(fds, nfds, to);
+ sigprocmask(SIG_SETMASK, &origmask, NULL);
+
+ return ready;
+}
+#endif
+
int main_loop(int listenfd)
{
int to, cnt, i, dto;