diff options
author | Martin Willi <martin@revosec.ch> | 2014-12-12 12:05:24 +0100 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-12-12 12:08:34 +0100 |
commit | 6e4620adfb29ae4767b9951d0d93d7840db2a7f9 (patch) | |
tree | 38505e90d32733dd9d311d2c4191b9b20348752a /src | |
parent | dce6f695464875bdf33dc92c5ddc0cf73d4964df (diff) | |
download | strongswan-6e4620adfb29ae4767b9951d0d93d7840db2a7f9.tar.bz2 strongswan-6e4620adfb29ae4767b9951d0d93d7840db2a7f9.tar.xz |
apple: Use precancelable poll() to wrap accept/recvmsg calls
To make accept/recvmsg cancelable, we wrap them with poll. As poll itself
does not honor pending cancellations when entering the function, we use our
variant that checks for pending cancellation requests before entering poll().
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils/compat/apple.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstrongswan/utils/compat/apple.h b/src/libstrongswan/utils/compat/apple.h index 06a7887e7..77e072279 100644 --- a/src/libstrongswan/utils/compat/apple.h +++ b/src/libstrongswan/utils/compat/apple.h @@ -34,6 +34,10 @@ /* Mach uses a semaphore_create() call, use a different name for ours */ #define semaphore_create(x) strongswan_semaphore_create(x) +/* forward declaration, see below */ +static inline int precancellable_poll(struct pollfd fds[], nfds_t nfds, + int timeout); + /* on Mac OS X 10.5 several system calls we use are no cancellation points. * fortunately, select isn't one of them, so we wrap some of the others with * calls to select(2). @@ -44,7 +48,7 @@ .fd = socket, \ .events = POLLIN, \ }; \ - if (poll(&pfd, 1, -1) <= 0) \ + if (precancellable_poll(&pfd, 1, -1) <= 0) \ {\ return -1; \ }\ |