commit 75e2addd08c4e73873d8e3511accb25a01e7e4d8 parent 5f8e3c9b93d13553a4e0d9df406091888a05dc7c Author: Evgeny Grin (Karlson2k) <k2k@narod.ru> Date: Wed, 1 Nov 2023 13:36:43 +0300 internal.h: added macros for polling mode detection Diffstat:
| M | src/microhttpd/internal.h | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 55 insertions(+), 0 deletions(-)
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h @@ -149,6 +149,61 @@ #endif /* ! MHD_STATICSTR_LEN_ */ +#if defined(HAVE_POLL) && defined(EPOLL_SUPPORT) +/** + * Checks whether the @a d daemon is using select() + */ +#define MHD_D_USING_SELECT_(d) \ + (0 == (d->options & (MHD_USE_POLL | MHD_USE_EPOLL))) +/** + * Checks whether the @a d daemon is using poll() + */ +#define MHD_D_USING_POLL_(d) (0 != (d->options & MHD_USE_POLL)) +/** + * Checks whether the @a d daemon is using epoll + */ +#define MHD_D_USING_EPOLL_(d) (0 != (d->options & MHD_USE_EPOLL)) +#elif defined(HAVE_POLL) +/** + * Checks whether the @a d daemon is using select() + */ +#define MHD_D_USING_SELECT_(d) (0 == (d->options & MHD_USE_POLL)) +/** + * Checks whether the @a d daemon is using poll() + */ +#define MHD_D_USING_POLL_(d) (0 != (d->options & MHD_USE_POLL)) +/** + * Checks whether the @a d daemon is using epoll + */ +#define MHD_D_USING_EPOLL_(d) (0) +#elif defined(EPOLL_SUPPORT) +/** + * Checks whether the @a d daemon is using select() + */ +#define MHD_D_USING_SELECT_(d) (0 == (d->options & MHD_USE_EPOLL)) +/** + * Checks whether the @a d daemon is using poll() + */ +#define MHD_D_USING_POLL_(d) (0) +/** + * Checks whether the @a d daemon is using epoll + */ +#define MHD_D_USING_EPOLL_(d) (0 != (d->options & MHD_USE_EPOLL)) +#else /* select() only */ +/** + * Checks whether the @a d daemon is using select() + */ +#define MHD_D_USING_SELECT_(d) (! 0) +/** + * Checks whether the @a d daemon is using poll() + */ +#define MHD_D_USING_POLL_(d) (0) +/** + * Checks whether the @a d daemon is using epoll + */ +#define MHD_D_USING_EPOLL_(d) (0) +#endif /* select() only */ + /** * Tri-state on/off/unknown */