Revert "Revert "Upgrade to 2.1.8-stable (2017-01-22)." and "Probably Mac build fix?""

This reverts commit 83a0c9c65a60a92d3ea5542596b3ba56db492c37.

Bug: 64543673
Test: make checkbuild
Test: Manual tombstoned test
Change-Id: I84bb128d1dec433195f2cbdbf70236ba17fa9955
diff --git a/event_iocp.c b/event_iocp.c
index 9648366..a9902fb 100644
--- a/event_iocp.c
+++ b/event_iocp.c
@@ -23,6 +23,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+#include "evconfig-private.h"
 
 #ifndef _WIN32_WINNT
 /* Minimum required for InitializeCriticalSectionAndSpinCount */
@@ -45,7 +46,7 @@
 #define NOTIFICATION_KEY ((ULONG_PTR)-1)
 
 void
-event_overlapped_init(struct event_overlapped *o, iocp_callback cb)
+event_overlapped_init_(struct event_overlapped *o, iocp_callback cb)
 {
 	memset(o, 0, sizeof(struct event_overlapped));
 	o->cb = cb;
@@ -60,9 +61,9 @@
 }
 
 static void
-loop(void *_port)
+loop(void *port_)
 {
-	struct event_iocp_port *port = _port;
+	struct event_iocp_port *port = port_;
 	long ms = port->ms;
 	HANDLE p = port->port;
 
@@ -98,7 +99,7 @@
 }
 
 int
-event_iocp_port_associate(struct event_iocp_port *port, evutil_socket_t fd,
+event_iocp_port_associate_(struct event_iocp_port *port, evutil_socket_t fd,
     ev_uintptr_t key)
 {
 	HANDLE h;
@@ -164,7 +165,7 @@
 static struct win32_extension_fns the_extension_fns;
 
 const struct win32_extension_fns *
-event_get_win32_extension_fns(void)
+event_get_win32_extension_fns_(void)
 {
 	return &the_extension_fns;
 }
@@ -172,7 +173,7 @@
 #define N_CPUS_DEFAULT 2
 
 struct event_iocp_port *
-event_iocp_port_launch(int n_cpus)
+event_iocp_port_launch_(int n_cpus)
 {
 	struct event_iocp_port *port;
 	int i;
@@ -223,7 +224,7 @@
 }
 
 static void
-_event_iocp_port_unlock_and_free(struct event_iocp_port *port)
+event_iocp_port_unlock_and_free_(struct event_iocp_port *port)
 {
 	DeleteCriticalSection(&port->lock);
 	CloseHandle(port->port);
@@ -246,7 +247,7 @@
 }
 
 int
-event_iocp_shutdown(struct event_iocp_port *port, long waitMsec)
+event_iocp_shutdown_(struct event_iocp_port *port, long waitMsec)
 {
 	DWORD ms = INFINITE;
 	int n;
@@ -264,7 +265,7 @@
 	n = port->n_live_threads;
 	LeaveCriticalSection(&port->lock);
 	if (n == 0) {
-		_event_iocp_port_unlock_and_free(port);
+		event_iocp_port_unlock_and_free_(port);
 		return 0;
 	} else {
 		return -1;
@@ -272,7 +273,7 @@
 }
 
 int
-event_iocp_activate_overlapped(
+event_iocp_activate_overlapped_(
     struct event_iocp_port *port, struct event_overlapped *o,
     ev_uintptr_t key, ev_uint32_t n)
 {
@@ -283,9 +284,9 @@
 }
 
 struct event_iocp_port *
-event_base_get_iocp(struct event_base *base)
+event_base_get_iocp_(struct event_base *base)
 {
-#ifdef WIN32
+#ifdef _WIN32
 	return base->iocp;
 #else
 	return NULL;