aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-08-24 15:02:16 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-08-24 15:02:16 +0000
commitcd030ca9cae26ecc21a916fb8e51a26bf3a7f9c4 (patch)
tree1cf810bc2e7c8167fc6b1acf709c84ed18617e87
parent9826ad54e0de815ca9a2b071717dc8aed1ce1a5c (diff)
downloadlibmicrohttpd-cd030ca9cae26ecc21a916fb8e51a26bf3a7f9c4.tar.gz
libmicrohttpd-cd030ca9cae26ecc21a916fb8e51a26bf3a7f9c4.zip
epoll is now supported on non-Linux platforms (namely illumos).
Renamed MHD options and updated documentation.
-rw-r--r--doc/libmicrohttpd.texi26
-rw-r--r--src/examples/benchmark.c2
-rw-r--r--src/examples/benchmark_https.c2
-rw-r--r--src/examples/demo.c2
-rw-r--r--src/examples/demo_https.c2
-rw-r--r--src/include/microhttpd.h29
-rw-r--r--src/microhttpd/connection.c4
-rw-r--r--src/microhttpd/daemon.c46
-rw-r--r--src/testcurl/https/test_https_get_parallel.c4
-rw-r--r--src/testcurl/https/test_https_get_select.c2
-rw-r--r--src/testcurl/perf_get.c10
-rw-r--r--src/testcurl/perf_get_concurrent.c4
-rw-r--r--src/testcurl/test_get.c8
-rw-r--r--src/testcurl/test_quiesce.c4
-rw-r--r--src/testcurl/test_start_stop.c4
15 files changed, 80 insertions, 69 deletions
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index 49a74b4c..b95e27b8 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -168,9 +168,9 @@ thread-per-connection (MHD creates one listen thread and then one
168thread per accepted connection). 168thread per accepted connection).
169 169
170These thread modes are then combined with the event loop styles. 170These thread modes are then combined with the event loop styles.
171MHD support select, poll and epoll. epoll is only available on 171MHD support select, poll and epoll. select is available on all
172Linux, poll may not be available on some platforms. Note that 172platforms, epoll and poll may not be available on some platforms.
173it is possible to combine MHD using epoll with an external 173Note that it is possible to combine MHD using epoll with an external
174select-based event loop. 174select-based event loop.
175 175
176The default (if no other option is passed) is ``external select''. 176The default (if no other option is passed) is ``external select''.
@@ -203,8 +203,8 @@ request within the callbacks from MHD must use a thread per
203connection. This is typically rather costly. Applications that do 203connection. This is typically rather costly. Applications that do
204not support threads or that must run on embedded devices without 204not support threads or that must run on embedded devices without
205thread-support must use the external mode. Using @code{epoll} is only 205thread-support must use the external mode. Using @code{epoll} is only
206supported on Linux, thus portable applications must at least have a 206supported on some platform, thus portable applications must at least
207fallback option available. @ref{tbl:supported} lists the sane 207have a fallback option available. @ref{tbl:supported} lists the sane
208combinations. 208combinations.
209 209
210@float Table,tbl:supported 210@float Table,tbl:supported
@@ -265,7 +265,7 @@ do not include the post processor API (results in binary incompatibility)
265do not include the authentication APIs (results in binary incompatibility) 265do not include the authentication APIs (results in binary incompatibility)
266 266
267@item ``--disable-epoll 267@item ``--disable-epoll
268do not include epoll support, even on Linux (minimally smaller binary size, good for testing portability to non-Linux systems) 268do not include epoll support, even if it supported (minimally smaller binary size, good for portability testing)
269 269
270@item ``--enable-coverage'' 270@item ``--enable-coverage''
271set flags for analysis of code-coverage with gcc/gcov (results in slow, large binaries) 271set flags for analysis of code-coverage with gcc/gcov (results in slow, large binaries)
@@ -504,15 +504,15 @@ conjunction with @code{MHD_USE_THREAD_PER_CONNECTION} or
504@code{MHD_USE_POLL} and the local platform does not support it, 504@code{MHD_USE_POLL} and the local platform does not support it,
505@code{MHD_start_daemon} will return NULL. 505@code{MHD_start_daemon} will return NULL.
506 506
507@item MHD_USE_EPOLL_LINUX_ONLY 507@item MHD_USE_EPOLL
508@cindex FD_SETSIZE 508@cindex FD_SETSIZE
509@cindex epoll 509@cindex epoll
510@cindex select 510@cindex select
511Use @code{epoll()} instead of @code{poll()} or @code{select()}. This 511Use @code{epoll()} instead of @code{poll()} or @code{select()}. This
512allows sockets with descriptors @code{>= FD_SETSIZE}. This option is 512allows sockets with descriptors @code{>= FD_SETSIZE}. This option is
513only available on Linux systems and does not work in conjunction with 513only available on some systems and does not work in conjunction with
514@code{MHD_USE_THREAD_PER_CONNECTION} (at this point). If you specify 514@code{MHD_USE_THREAD_PER_CONNECTION} (at this point). If you specify
515@code{MHD_USE_EPOLL_LINUX_ONLY} and the local platform does not 515@code{MHD_USE_EPOLL} and the local platform does not
516support it, @code{MHD_start_daemon} will return NULL. Using 516support it, @code{MHD_start_daemon} will return NULL. Using
517@code{epoll()} instead of @code{select()} or @code{poll()} can in some 517@code{epoll()} instead of @code{select()} or @code{poll()} can in some
518situations result in significantly higher performance as the system 518situations result in significantly higher performance as the system
@@ -524,7 +524,7 @@ open connections).
524@cindex performance 524@cindex performance
525Enable optimizations to aggressively improve performance. Note that 525Enable optimizations to aggressively improve performance. Note that
526the option is a slight misnomer, as these days it also enables optimziations 526the option is a slight misnomer, as these days it also enables optimziations
527that are unrelated to @code{MHD_USE_EPOLL_LINUX_ONLY}. Hence it is OK to 527that are unrelated to @code{MHD_USE_EPOLL}. Hence it is OK to
528use this option with other event loops. 528use this option with other event loops.
529 529
530Currently, the optimizations this option enables are based on 530Currently, the optimizations this option enables are based on
@@ -2550,7 +2550,7 @@ No extra arguments should be passed.
2550Request the file-descriptor number that MHD is using for epoll. If 2550Request the file-descriptor number that MHD is using for epoll. If
2551the build is not supporting epoll, NULL is returned; if we are using a 2551the build is not supporting epoll, NULL is returned; if we are using a
2552thread pool or this daemon was not started with 2552thread pool or this daemon was not started with
2553@code{MHD_USE_EPOLL_LINUX_ONLY}, (a pointer to) -1 is returned. If we are 2553@code{MHD_USE_EPOLL}, (a pointer to) -1 is returned. If we are
2554using @code{MHD_USE_SELECT_INTERNALLY} or are in 'external' select mode, the 2554using @code{MHD_USE_SELECT_INTERNALLY} or are in 'external' select mode, the
2555internal epoll FD is returned. This function must be used in external 2555internal epoll FD is returned. This function must be used in external
2556select mode with epoll to obtain the FD to call epoll on. No extra 2556select mode with epoll to obtain the FD to call epoll on. No extra
@@ -2763,8 +2763,8 @@ MHD_USE_POLL can be used.
2763 2763
2764@item MHD_FEATURE_EPOLL 2764@item MHD_FEATURE_EPOLL
2765Get whether @code{epoll()} is supported. If supported then Flags 2765Get whether @code{epoll()} is supported. If supported then Flags
2766MHD_USE_EPOLL_LINUX_ONLY and 2766MHD_USE_EPOLL and
2767MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used. 2767MHD_USE_EPOLL_INTERNALLY can be used.
2768 2768
2769@item MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET 2769@item MHD_FEATURE_SHUTDOWN_LISTEN_SOCKET
2770Get whether shutdown on listen socket to signal other 2770Get whether shutdown on listen socket to signal other
diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c
index bb103c98..ff470205 100644
--- a/src/examples/benchmark.c
+++ b/src/examples/benchmark.c
@@ -136,7 +136,7 @@ main (int argc, char *const *argv)
136#endif 136#endif
137 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_SUPPRESS_DATE_NO_CLOCK 137 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_SUPPRESS_DATE_NO_CLOCK
138#ifdef EPOLL_SUPPORT 138#ifdef EPOLL_SUPPORT
139 | MHD_USE_EPOLL_LINUX_ONLY | MHD_USE_EPOLL_TURBO 139 | MHD_USE_EPOLL | MHD_USE_EPOLL_TURBO
140#endif 140#endif
141 , 141 ,
142 atoi (argv[1]), 142 atoi (argv[1]),
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index 5d7171be..5cfd425e 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.c
@@ -182,7 +182,7 @@ main (int argc, char *const *argv)
182 MHD_RESPMEM_PERSISTENT); 182 MHD_RESPMEM_PERSISTENT);
183 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL 183 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL
184#ifdef EPOLL_SUPPORT 184#ifdef EPOLL_SUPPORT
185 | MHD_USE_EPOLL_LINUX_ONLY | MHD_USE_EPOLL_TURBO 185 | MHD_USE_EPOLL | MHD_USE_EPOLL_TURBO
186#endif 186#endif
187 , 187 ,
188 atoi (argv[1]), 188 atoi (argv[1]),
diff --git a/src/examples/demo.c b/src/examples/demo.c
index eca2c069..400f31cd 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -885,7 +885,7 @@ main (int argc, char *const *argv)
885 update_directory (); 885 update_directory ();
886 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG 886 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG
887#ifdef EPOLL_SUPPORT 887#ifdef EPOLL_SUPPORT
888 | MHD_USE_EPOLL_LINUX_ONLY 888 | MHD_USE_EPOLL
889#endif 889#endif
890 , 890 ,
891 port, 891 port,
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index a80ce5cf..10fc3312 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -934,7 +934,7 @@ main (int argc, char *const *argv)
934 update_directory (); 934 update_directory ();
935 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | MHD_USE_SSL 935 d = MHD_start_daemon (MHD_USE_SELECT_INTERNALLY | MHD_USE_DEBUG | MHD_USE_SSL
936#ifdef EPOLL_SUPPORT 936#ifdef EPOLL_SUPPORT
937 | MHD_USE_EPOLL_LINUX_ONLY 937 | MHD_USE_EPOLL
938#endif 938#endif
939 , 939 ,
940 port, 940 port,
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index e44bb704..baff3974 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -126,7 +126,7 @@ typedef intptr_t ssize_t;
126 * Current version of the library. 126 * Current version of the library.
127 * 0x01093001 = 1.9.30-1. 127 * 0x01093001 = 1.9.30-1.
128 */ 128 */
129#define MHD_VERSION 0x00095008 129#define MHD_VERSION 0x00095009
130 130
131/** 131/**
132 * MHD-internal return code for "YES". 132 * MHD-internal return code for "YES".
@@ -577,7 +577,7 @@ enum MHD_FLAG
577 * FD_SETSIZE`. This option is not compatible with using an 577 * FD_SETSIZE`. This option is not compatible with using an
578 * 'external' `select()` mode (as there is no API to get the file 578 * 'external' `select()` mode (as there is no API to get the file
579 * descriptors for the external select from MHD) and must also not 579 * descriptors for the external select from MHD) and must also not
580 * be used in combination with #MHD_USE_EPOLL_LINUX_ONLY. 580 * be used in combination with #MHD_USE_EPOLL.
581 */ 581 */
582 MHD_USE_POLL = 64, 582 MHD_USE_POLL = 64,
583 583
@@ -605,18 +605,29 @@ enum MHD_FLAG
605 605
606 /** 606 /**
607 * Use `epoll()` instead of `select()` or `poll()` for the event loop. 607 * Use `epoll()` instead of `select()` or `poll()` for the event loop.
608 * This option is only available on Linux; using the option on 608 * This option is only available on some systems; using the option on
609 * non-Linux systems will cause #MHD_start_daemon to fail. Using 609 * systems without epoll will cause #MHD_start_daemon to fail. Using
610 * this option is not supported with #MHD_USE_THREAD_PER_CONNECTION. 610 * this option is not supported with #MHD_USE_THREAD_PER_CONNECTION.
611 * @sa ::MHD_FEATURE_EPOLL
611 */ 612 */
612 MHD_USE_EPOLL_LINUX_ONLY = 512, 613 MHD_USE_EPOLL = 512,
614
615/** @deprecated */
616#define MHD_USE_EPOLL_LINUX_ONLY \
617 _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_LINUX_ONLY is deprecated, use MHD_USE_EPOLL") \
618 MHD_USE_EPOLL
613 619
614 /** 620 /**
615 * Run using an internal thread (or thread pool) doing `epoll()`. 621 * Run using an internal thread (or thread pool) doing `epoll()`.
616 * This option is only available on Linux; using the option on 622 * This option is only available on Linux; using the option on
617 * non-Linux systems will cause #MHD_start_daemon to fail. 623 * non-Linux systems will cause #MHD_start_daemon to fail.
618 */ 624 */
619 MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_EPOLL_LINUX_ONLY, 625 MHD_USE_EPOLL_INTERNALLY = MHD_USE_SELECT_INTERNALLY | MHD_USE_EPOLL,
626
627/** @deprecated */
628#define MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY \
629 _MHD_DEPR_IN_MACRO("Value MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY is deprecated, use MHD_USE_EPOLL_INTERNALLY") \
630 MHD_USE_EPOLL_INTERNALLY
620 631
621 /** 632 /**
622 * Force MHD to use a signal pipe to notify the event loop (of 633 * Force MHD to use a signal pipe to notify the event loop (of
@@ -644,7 +655,7 @@ enum MHD_FLAG
644 /** 655 /**
645 * Enable `epoll()` turbo. Disables certain calls to `shutdown()` 656 * Enable `epoll()` turbo. Disables certain calls to `shutdown()`
646 * and enables aggressive non-blocking optimisitc reads. 657 * and enables aggressive non-blocking optimisitc reads.
647 * Most effects only happen with #MHD_USE_EPOLL_LINUX_ONLY. 658 * Most effects only happen with #MHD_USE_EPOLL.
648 * Enalbed always on W32 as winsock does not properly behave 659 * Enalbed always on W32 as winsock does not properly behave
649 * with `shutdown()` and this then fixes potential problems. 660 * with `shutdown()` and this then fixes potential problems.
650 */ 661 */
@@ -2750,8 +2761,8 @@ enum MHD_FEATURE
2750 2761
2751 /** 2762 /**
2752 * Get whether `epoll()` is supported. If supported then Flags 2763 * Get whether `epoll()` is supported. If supported then Flags
2753 * #MHD_USE_EPOLL_LINUX_ONLY and 2764 * #MHD_USE_EPOLL and
2754 * #MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY can be used. 2765 * #MHD_USE_EPOLL_INTERNALLY can be used.
2755 */ 2766 */
2756 MHD_FEATURE_EPOLL = 7, 2767 MHD_FEATURE_EPOLL = 7,
2757 2768
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 279aeaff..cccfa774 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -2895,7 +2895,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2895 } 2895 }
2896 MHD_connection_update_event_loop_info (connection); 2896 MHD_connection_update_event_loop_info (connection);
2897#ifdef EPOLL_SUPPORT 2897#ifdef EPOLL_SUPPORT
2898 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 2898 if (0 != (daemon->options & MHD_USE_EPOLL))
2899 { 2899 {
2900 switch (connection->event_loop_info) 2900 switch (connection->event_loop_info)
2901 { 2901 {
@@ -2959,7 +2959,7 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection)
2959{ 2959{
2960 struct MHD_Daemon *daemon = connection->daemon; 2960 struct MHD_Daemon *daemon = connection->daemon;
2961 2961
2962 if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && 2962 if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
2963 (0 == (connection->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) && 2963 (0 == (connection->epoll_state & MHD_EPOLL_STATE_IN_EPOLL_SET)) &&
2964 (0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED)) && 2964 (0 == (connection->epoll_state & MHD_EPOLL_STATE_SUSPENDED)) &&
2965 ( (0 == (connection->epoll_state & MHD_EPOLL_STATE_WRITE_READY)) || 2965 ( (0 == (connection->epoll_state & MHD_EPOLL_STATE_WRITE_READY)) ||
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index d813ca1b..19cd9a7c 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -664,7 +664,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
664 || (0 != (daemon->options & MHD_USE_POLL))) 664 || (0 != (daemon->options & MHD_USE_POLL)))
665 return MHD_NO; 665 return MHD_NO;
666#ifdef EPOLL_SUPPORT 666#ifdef EPOLL_SUPPORT
667 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 667 if (0 != (daemon->options & MHD_USE_EPOLL))
668 { 668 {
669 /* we're in epoll mode, use the epoll FD as a stand-in for 669 /* we're in epoll mode, use the epoll FD as a stand-in for
670 the entire event set */ 670 the entire event set */
@@ -1240,7 +1240,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1240 } 1240 }
1241 1241
1242 if ( (!MHD_SCKT_FD_FITS_FDSET_(client_socket, NULL)) && 1242 if ( (!MHD_SCKT_FD_FITS_FDSET_(client_socket, NULL)) &&
1243 (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) ) 1243 (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) )
1244 { 1244 {
1245#ifdef HAVE_MESSAGES 1245#ifdef HAVE_MESSAGES
1246 MHD_DLOG (daemon, 1246 MHD_DLOG (daemon,
@@ -1486,7 +1486,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1486#endif 1486#endif
1487 } 1487 }
1488#ifdef EPOLL_SUPPORT 1488#ifdef EPOLL_SUPPORT
1489 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 1489 if (0 != (daemon->options & MHD_USE_EPOLL))
1490 { 1490 {
1491 if (0 == (daemon->options & MHD_USE_EPOLL_TURBO)) 1491 if (0 == (daemon->options & MHD_USE_EPOLL_TURBO))
1492 { 1492 {
@@ -1611,7 +1611,7 @@ MHD_suspend_connection (struct MHD_Connection *connection)
1611 daemon->suspended_connections_tail, 1611 daemon->suspended_connections_tail,
1612 connection); 1612 connection);
1613#ifdef EPOLL_SUPPORT 1613#ifdef EPOLL_SUPPORT
1614 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 1614 if (0 != (daemon->options & MHD_USE_EPOLL))
1615 { 1615 {
1616 if (0 != (connection->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) 1616 if (0 != (connection->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL))
1617 { 1617 {
@@ -1729,7 +1729,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
1729 pos); 1729 pos);
1730 } 1730 }
1731#ifdef EPOLL_SUPPORT 1731#ifdef EPOLL_SUPPORT
1732 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 1732 if (0 != (daemon->options & MHD_USE_EPOLL))
1733 { 1733 {
1734 if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) 1734 if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL))
1735 MHD_PANIC ("Resumed connection was already in EREADY set\n"); 1735 MHD_PANIC ("Resumed connection was already in EREADY set\n");
@@ -1971,7 +1971,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
1971 MHD_CONNECTION_NOTIFY_CLOSED); 1971 MHD_CONNECTION_NOTIFY_CLOSED);
1972 MHD_ip_limit_del (daemon, pos->addr, pos->addr_len); 1972 MHD_ip_limit_del (daemon, pos->addr, pos->addr_len);
1973#ifdef EPOLL_SUPPORT 1973#ifdef EPOLL_SUPPORT
1974 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 1974 if (0 != (daemon->options & MHD_USE_EPOLL))
1975 { 1975 {
1976 if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL)) 1976 if (0 != (pos->epoll_state & MHD_EPOLL_STATE_IN_EREADY_EDLL))
1977 { 1977 {
@@ -2138,7 +2138,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
2138 MHD_socket ds; 2138 MHD_socket ds;
2139 struct MHD_Connection *pos; 2139 struct MHD_Connection *pos;
2140 struct MHD_Connection *next; 2140 struct MHD_Connection *next;
2141 unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY | 2141 unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY |
2142 MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION; 2142 MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION;
2143 2143
2144 /* drain signaling pipe to avoid spinning select */ 2144 /* drain signaling pipe to avoid spinning select */
@@ -2153,7 +2153,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
2153 resume_suspended_connections (daemon); 2153 resume_suspended_connections (daemon);
2154 2154
2155#ifdef EPOLL_SUPPORT 2155#ifdef EPOLL_SUPPORT
2156 if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 2156 if (0 != (daemon->options & MHD_USE_EPOLL))
2157 { 2157 {
2158 /* we're in epoll mode, the epoll FD stands for 2158 /* we're in epoll mode, the epoll FD stands for
2159 the entire event set! */ 2159 the entire event set! */
@@ -2834,7 +2834,7 @@ MHD_run (struct MHD_Daemon *daemon)
2834 MHD_cleanup_connections (daemon); 2834 MHD_cleanup_connections (daemon);
2835 } 2835 }
2836#ifdef EPOLL_SUPPORT 2836#ifdef EPOLL_SUPPORT
2837 else if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 2837 else if (0 != (daemon->options & MHD_USE_EPOLL))
2838 { 2838 {
2839 MHD_epoll (daemon, MHD_NO); 2839 MHD_epoll (daemon, MHD_NO);
2840 MHD_cleanup_connections (daemon); 2840 MHD_cleanup_connections (daemon);
@@ -2866,7 +2866,7 @@ MHD_select_thread (void *cls)
2866 if (0 != (daemon->options & MHD_USE_POLL)) 2866 if (0 != (daemon->options & MHD_USE_POLL))
2867 MHD_poll (daemon, MHD_YES); 2867 MHD_poll (daemon, MHD_YES);
2868#ifdef EPOLL_SUPPORT 2868#ifdef EPOLL_SUPPORT
2869 else if (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) 2869 else if (0 != (daemon->options & MHD_USE_EPOLL))
2870 MHD_epoll (daemon, MHD_YES); 2870 MHD_epoll (daemon, MHD_YES);
2871#endif 2871#endif
2872 else 2872 else
@@ -2973,7 +2973,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
2973 { 2973 {
2974 daemon->worker_pool[i].socket_fd = MHD_INVALID_SOCKET; 2974 daemon->worker_pool[i].socket_fd = MHD_INVALID_SOCKET;
2975#ifdef EPOLL_SUPPORT 2975#ifdef EPOLL_SUPPORT
2976 if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && 2976 if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
2977 (-1 != daemon->worker_pool[i].epoll_fd) && 2977 (-1 != daemon->worker_pool[i].epoll_fd) &&
2978 (MHD_YES == daemon->worker_pool[i].listen_socket_in_epoll) ) 2978 (MHD_YES == daemon->worker_pool[i].listen_socket_in_epoll) )
2979 { 2979 {
@@ -2994,7 +2994,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
2994 } 2994 }
2995 daemon->socket_fd = MHD_INVALID_SOCKET; 2995 daemon->socket_fd = MHD_INVALID_SOCKET;
2996#ifdef EPOLL_SUPPORT 2996#ifdef EPOLL_SUPPORT
2997 if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && 2997 if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
2998 (-1 != daemon->epoll_fd) && 2998 (-1 != daemon->epoll_fd) &&
2999 (MHD_YES == daemon->listen_socket_in_epoll) ) 2999 (MHD_YES == daemon->listen_socket_in_epoll) )
3000 { 3000 {
@@ -3628,7 +3628,7 @@ MHD_start_daemon_va (unsigned int flags,
3628#endif 3628#endif
3629 } 3629 }
3630 } 3630 }
3631 if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) && 3631 if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
3632 (1 == use_pipe) && 3632 (1 == use_pipe) &&
3633 (!MHD_SCKT_FD_FITS_FDSET_(daemon->wpipe[0], NULL)) ) 3633 (!MHD_SCKT_FD_FITS_FDSET_(daemon->wpipe[0], NULL)) )
3634 { 3634 {
@@ -3974,7 +3974,7 @@ MHD_start_daemon_va (unsigned int flags,
3974 "Failed to set nonblocking mode on listening socket: %s\n", 3974 "Failed to set nonblocking mode on listening socket: %s\n",
3975 MHD_socket_last_strerr_()); 3975 MHD_socket_last_strerr_());
3976#endif 3976#endif
3977 if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY) || 3977 if (0 != (flags & MHD_USE_EPOLL) ||
3978 daemon->worker_pool_size > 0) 3978 daemon->worker_pool_size > 0)
3979 { 3979 {
3980 /* Accept must be non-blocking. Multiple children may wake up 3980 /* Accept must be non-blocking. Multiple children may wake up
@@ -3986,7 +3986,7 @@ MHD_start_daemon_va (unsigned int flags,
3986 } 3986 }
3987 } 3987 }
3988 if ( (!MHD_SCKT_FD_FITS_FDSET_(socket_fd, NULL)) && 3988 if ( (!MHD_SCKT_FD_FITS_FDSET_(socket_fd, NULL)) &&
3989 (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) ) 3989 (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) )
3990 { 3990 {
3991#ifdef HAVE_MESSAGES 3991#ifdef HAVE_MESSAGES
3992 MHD_DLOG (daemon, 3992 MHD_DLOG (daemon,
@@ -4000,7 +4000,7 @@ MHD_start_daemon_va (unsigned int flags,
4000 } 4000 }
4001 4001
4002#ifdef EPOLL_SUPPORT 4002#ifdef EPOLL_SUPPORT
4003 if ( (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) && 4003 if ( (0 != (flags & MHD_USE_EPOLL)) &&
4004 (0 == daemon->worker_pool_size) && 4004 (0 == daemon->worker_pool_size) &&
4005 (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) ) 4005 (0 == (daemon->options & MHD_USE_NO_LISTEN_SOCKET)) )
4006 { 4006 {
@@ -4008,7 +4008,7 @@ MHD_start_daemon_va (unsigned int flags,
4008 { 4008 {
4009#ifdef HAVE_MESSAGES 4009#ifdef HAVE_MESSAGES
4010 MHD_DLOG (daemon, 4010 MHD_DLOG (daemon,
4011 "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL_LINUX_ONLY is not supported.\n"); 4011 "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n");
4012#endif 4012#endif
4013 goto free_and_fail; 4013 goto free_and_fail;
4014 } 4014 }
@@ -4016,7 +4016,7 @@ MHD_start_daemon_va (unsigned int flags,
4016 goto free_and_fail; 4016 goto free_and_fail;
4017 } 4017 }
4018#else 4018#else
4019 if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) 4019 if (0 != (flags & MHD_USE_EPOLL))
4020 { 4020 {
4021#ifdef HAVE_MESSAGES 4021#ifdef HAVE_MESSAGES
4022 MHD_DLOG (daemon, 4022 MHD_DLOG (daemon,
@@ -4152,7 +4152,7 @@ MHD_start_daemon_va (unsigned int flags,
4152#endif 4152#endif
4153 } 4153 }
4154 } 4154 }
4155 if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) && 4155 if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
4156 (!MHD_SCKT_FD_FITS_FDSET_(d->wpipe[0], NULL)) ) 4156 (!MHD_SCKT_FD_FITS_FDSET_(d->wpipe[0], NULL)) )
4157 { 4157 {
4158#ifdef HAVE_MESSAGES 4158#ifdef HAVE_MESSAGES
@@ -4173,7 +4173,7 @@ MHD_start_daemon_va (unsigned int flags,
4173 if (i < leftover_conns) 4173 if (i < leftover_conns)
4174 ++d->connection_limit; 4174 ++d->connection_limit;
4175#ifdef EPOLL_SUPPORT 4175#ifdef EPOLL_SUPPORT
4176 if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && 4176 if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
4177 (MHD_YES != setup_epoll_to_listen (d)) ) 4177 (MHD_YES != setup_epoll_to_listen (d)) )
4178 goto thread_failed; 4178 goto thread_failed;
4179#endif 4179#endif
@@ -4418,7 +4418,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
4418 daemon->worker_pool[i].shutdown = MHD_YES; 4418 daemon->worker_pool[i].shutdown = MHD_YES;
4419 daemon->worker_pool[i].socket_fd = MHD_INVALID_SOCKET; 4419 daemon->worker_pool[i].socket_fd = MHD_INVALID_SOCKET;
4420#ifdef EPOLL_SUPPORT 4420#ifdef EPOLL_SUPPORT
4421 if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && 4421 if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
4422 (-1 != daemon->worker_pool[i].epoll_fd) && 4422 (-1 != daemon->worker_pool[i].epoll_fd) &&
4423 (MHD_INVALID_SOCKET == fd) ) 4423 (MHD_INVALID_SOCKET == fd) )
4424 epoll_shutdown (&daemon->worker_pool[i]); 4424 epoll_shutdown (&daemon->worker_pool[i]);
@@ -4440,7 +4440,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
4440 } 4440 }
4441#endif 4441#endif
4442#ifdef EPOLL_SUPPORT 4442#ifdef EPOLL_SUPPORT
4443 if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && 4443 if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
4444 (-1 != daemon->epoll_fd) && 4444 (-1 != daemon->epoll_fd) &&
4445 (MHD_INVALID_SOCKET == fd) ) 4445 (MHD_INVALID_SOCKET == fd) )
4446 epoll_shutdown (daemon); 4446 epoll_shutdown (daemon);
@@ -4521,7 +4521,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
4521 } 4521 }
4522#endif 4522#endif
4523#ifdef EPOLL_SUPPORT 4523#ifdef EPOLL_SUPPORT
4524 if ( (0 != (daemon->options & MHD_USE_EPOLL_LINUX_ONLY)) && 4524 if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
4525 (-1 != daemon->epoll_fd) && 4525 (-1 != daemon->epoll_fd) &&
4526 (0 != MHD_socket_close_ (daemon->epoll_fd)) ) 4526 (0 != MHD_socket_close_ (daemon->epoll_fd)) )
4527 MHD_PANIC ("close failed\n"); 4527 MHD_PANIC ("close failed\n");
diff --git a/src/testcurl/https/test_https_get_parallel.c b/src/testcurl/https/test_https_get_parallel.c
index 5b1b23f5..41b0aae9 100644
--- a/src/testcurl/https/test_https_get_parallel.c
+++ b/src/testcurl/https/test_https_get_parallel.c
@@ -151,7 +151,7 @@ main (int argc, char *const *argv)
151 errorCount += 151 errorCount +=
152 test_wrap ("single threaded daemon, single client, epoll", &test_single_client, 152 test_wrap ("single threaded daemon, single client, epoll", &test_single_client,
153 NULL, 153 NULL,
154 MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL_LINUX_ONLY, 154 MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL,
155 aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, 155 aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
156 srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, 156 srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
157 srv_self_signed_cert_pem, MHD_OPTION_END); 157 srv_self_signed_cert_pem, MHD_OPTION_END);
@@ -167,7 +167,7 @@ main (int argc, char *const *argv)
167 errorCount += 167 errorCount +=
168 test_wrap ("single threaded daemon, parallel clients, epoll", 168 test_wrap ("single threaded daemon, parallel clients, epoll",
169 &test_parallel_clients, NULL, 169 &test_parallel_clients, NULL,
170 MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL_LINUX_ONLY, 170 MHD_USE_SELECT_INTERNALLY | MHD_USE_SSL | MHD_USE_DEBUG | MHD_USE_EPOLL,
171 aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY, 171 aes256_sha, CURL_SSLVERSION_TLSv1, MHD_OPTION_HTTPS_MEM_KEY,
172 srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT, 172 srv_key_pem, MHD_OPTION_HTTPS_MEM_CERT,
173 srv_self_signed_cert_pem, MHD_OPTION_END); 173 srv_self_signed_cert_pem, MHD_OPTION_END);
diff --git a/src/testcurl/https/test_https_get_select.c b/src/testcurl/https/test_https_get_select.c
index e3e7af93..056e64ac 100644
--- a/src/testcurl/https/test_https_get_select.c
+++ b/src/testcurl/https/test_https_get_select.c
@@ -224,7 +224,7 @@ main (int argc, char *const *argv)
224 return -1; 224 return -1;
225 } 225 }
226#ifdef EPOLL_SUPPORT 226#ifdef EPOLL_SUPPORT
227 if (0 != (errorCount = testExternalGet (MHD_USE_EPOLL_LINUX_ONLY))) 227 if (0 != (errorCount = testExternalGet (MHD_USE_EPOLL)))
228 fprintf (stderr, "Fail: %d\n", errorCount); 228 fprintf (stderr, "Fail: %d\n", errorCount);
229#endif 229#endif
230 if (0 != (errorCount = testExternalGet (0))) 230 if (0 != (errorCount = testExternalGet (0)))
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index 7ed706b7..c39d9ec2 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -227,7 +227,7 @@ testInternalGet (int port, int poll_flag)
227 curl_easy_cleanup (c); 227 curl_easy_cleanup (c);
228 } 228 }
229 stop (poll_flag == MHD_USE_POLL ? "internal poll" : 229 stop (poll_flag == MHD_USE_POLL ? "internal poll" :
230 poll_flag == MHD_USE_EPOLL_LINUX_ONLY ? "internal epoll" : "internal select"); 230 poll_flag == MHD_USE_EPOLL ? "internal epoll" : "internal select");
231 MHD_stop_daemon (d); 231 MHD_stop_daemon (d);
232 if (cbc.pos != strlen ("/hello_world")) 232 if (cbc.pos != strlen ("/hello_world"))
233 return 4; 233 return 4;
@@ -287,7 +287,7 @@ testMultithreadedGet (int port, int poll_flag)
287 curl_easy_cleanup (c); 287 curl_easy_cleanup (c);
288 } 288 }
289 stop ((poll_flag & MHD_USE_POLL) ? "thread with poll" : 289 stop ((poll_flag & MHD_USE_POLL) ? "thread with poll" :
290 (poll_flag & MHD_USE_EPOLL_LINUX_ONLY) ? "thread with epoll" : "thread with select"); 290 (poll_flag & MHD_USE_EPOLL) ? "thread with epoll" : "thread with select");
291 MHD_stop_daemon (d); 291 MHD_stop_daemon (d);
292 if (cbc.pos != strlen ("/hello_world")) 292 if (cbc.pos != strlen ("/hello_world"))
293 return 64; 293 return 64;
@@ -347,7 +347,7 @@ testMultithreadedPoolGet (int port, int poll_flag)
347 curl_easy_cleanup (c); 347 curl_easy_cleanup (c);
348 } 348 }
349 stop (0 != (poll_flag & MHD_USE_POLL) ? "thread pool with poll" : 349 stop (0 != (poll_flag & MHD_USE_POLL) ? "thread pool with poll" :
350 0 != (poll_flag & MHD_USE_EPOLL_LINUX_ONLY) ? "thread pool with epoll" : "thread pool with select"); 350 0 != (poll_flag & MHD_USE_EPOLL) ? "thread pool with epoll" : "thread pool with select");
351 MHD_stop_daemon (d); 351 MHD_stop_daemon (d);
352 if (cbc.pos != strlen ("/hello_world")) 352 if (cbc.pos != strlen ("/hello_world"))
353 return 64; 353 return 64;
@@ -527,8 +527,8 @@ main (int argc, char *const *argv)
527 } 527 }
528 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) 528 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
529 { 529 {
530 errorCount += testInternalGet(port++, MHD_USE_EPOLL_LINUX_ONLY); 530 errorCount += testInternalGet(port++, MHD_USE_EPOLL);
531 errorCount += testMultithreadedPoolGet(port++, MHD_USE_EPOLL_LINUX_ONLY); 531 errorCount += testMultithreadedPoolGet(port++, MHD_USE_EPOLL);
532 } 532 }
533 MHD_destroy_response (response); 533 MHD_destroy_response (response);
534 if (errorCount != 0) 534 if (errorCount != 0)
diff --git a/src/testcurl/perf_get_concurrent.c b/src/testcurl/perf_get_concurrent.c
index cf1bfe83..95ec3fa1 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -399,8 +399,8 @@ main (int argc, char *const *argv)
399 } 399 }
400 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) 400 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
401 { 401 {
402 errorCount += testInternalGet (port++, MHD_USE_EPOLL_LINUX_ONLY); 402 errorCount += testInternalGet (port++, MHD_USE_EPOLL);
403 errorCount += testMultithreadedPoolGet (port++, MHD_USE_EPOLL_LINUX_ONLY); 403 errorCount += testMultithreadedPoolGet (port++, MHD_USE_EPOLL);
404 } 404 }
405 MHD_destroy_response (response); 405 MHD_destroy_response (response);
406 if (errorCount != 0) 406 if (errorCount != 0)
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index 892bd243..1fc6df17 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -634,10 +634,10 @@ main (int argc, char *const *argv)
634 } 634 }
635 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) 635 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
636 { 636 {
637 errorCount += testInternalGet(MHD_USE_EPOLL_LINUX_ONLY); 637 errorCount += testInternalGet(MHD_USE_EPOLL);
638 errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL_LINUX_ONLY); 638 errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL);
639 errorCount += testUnknownPortGet(MHD_USE_EPOLL_LINUX_ONLY); 639 errorCount += testUnknownPortGet(MHD_USE_EPOLL);
640 errorCount += testEmptyGet(MHD_USE_EPOLL_LINUX_ONLY); 640 errorCount += testEmptyGet(MHD_USE_EPOLL);
641 } 641 }
642 if (errorCount != 0) 642 if (errorCount != 0)
643 fprintf (stderr, "Error (code: %u)\n", errorCount); 643 fprintf (stderr, "Error (code: %u)\n", errorCount);
diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c
index f4002348..9ff3086c 100644
--- a/src/testcurl/test_quiesce.c
+++ b/src/testcurl/test_quiesce.c
@@ -482,8 +482,8 @@ main (int argc, char *const *argv)
482 } 482 }
483 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) 483 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
484 { 484 {
485 errorCount += testGet (MHD_USE_SELECT_INTERNALLY, 0, MHD_USE_EPOLL_LINUX_ONLY); 485 errorCount += testGet (MHD_USE_SELECT_INTERNALLY, 0, MHD_USE_EPOLL);
486 errorCount += testGet (MHD_USE_SELECT_INTERNALLY, CPU_COUNT, MHD_USE_EPOLL_LINUX_ONLY); 486 errorCount += testGet (MHD_USE_SELECT_INTERNALLY, CPU_COUNT, MHD_USE_EPOLL);
487 } 487 }
488 if (errorCount != 0) 488 if (errorCount != 0)
489 fprintf (stderr, "Error (code: %u)\n", errorCount); 489 fprintf (stderr, "Error (code: %u)\n", errorCount);
diff --git a/src/testcurl/test_start_stop.c b/src/testcurl/test_start_stop.c
index ce1b445b..66d19f0e 100644
--- a/src/testcurl/test_start_stop.c
+++ b/src/testcurl/test_start_stop.c
@@ -120,8 +120,8 @@ main (int argc, char *const *argv)
120 } 120 }
121 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL)) 121 if (MHD_YES == MHD_is_feature_supported(MHD_FEATURE_EPOLL))
122 { 122 {
123 errorCount += testInternalGet(MHD_USE_EPOLL_LINUX_ONLY); 123 errorCount += testInternalGet(MHD_USE_EPOLL);
124 errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL_LINUX_ONLY); 124 errorCount += testMultithreadedPoolGet(MHD_USE_EPOLL);
125 } 125 }
126 if (errorCount != 0) 126 if (errorCount != 0)
127 fprintf (stderr, "Error (code: %u)\n", errorCount); 127 fprintf (stderr, "Error (code: %u)\n", errorCount);