+static int have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work? */
+
+#include "ev_win32.c"
+
+/*****************************************************************************/
+
+static void (*syserr_cb)(const char *msg);
+
+void ev_set_syserr_cb (void (*cb)(const char *msg))
+{
+ syserr_cb = cb;
+}
+
+static void
+syserr (const char *msg)
+{
+ if (!msg)
+ msg = "(libev) system error";
+
+ if (syserr_cb)
+ syserr_cb (msg);
+ else
+ {
+ perror (msg);
+ abort ();
+ }
+}
+
+static void *(*alloc)(void *ptr, long size);
+
+void ev_set_allocator (void *(*cb)(void *ptr, long size))
+{
+ alloc = cb;
+}
+
+static void *
+ev_realloc (void *ptr, long size)
+{
+ ptr = alloc ? alloc (ptr, size) : realloc (ptr, size);
+
+ if (!ptr && size)
+ {
+ fprintf (stderr, "libev: cannot allocate %ld bytes, aborting.", size);
+ abort ();
+ }
+
+ return ptr;
+}
+
+#define ev_malloc(size) ev_realloc (0, (size))
+#define ev_free(ptr) ev_realloc ((ptr), 0)
+
+/*****************************************************************************/
+
+typedef struct
+{
+ WL head;
+ unsigned char events;
+ unsigned char reify;
+} ANFD;
+
+typedef struct
+{
+ W w;
+ int events;
+} ANPENDING;
+
+#if EV_MULTIPLICITY
+
+ struct ev_loop
+ {
+ ev_tstamp ev_rt_now;
+ #define VAR(name,decl) decl;
+ #include "ev_vars.h"
+ #undef VAR
+ };
+ #include "ev_wrap.h"
+
+ struct ev_loop default_loop_struct;
+ static struct ev_loop *default_loop;