To compile TrafficServer with libev

1. Get the libev source by either:
   a. Pull the libev source into the root of the TS source
      cvs -z3 -d :pserver:anonymous@cvs.schmorp.de/schmorpforge co libev

 OR

   b. Download libev tar ball e.g. libev-3.8.tar.gz  and extract into 
      toplevel TS source directory. Next symlink the extracted directory 
      to 'libev' e.g. 'ln -s libev-3.8 libev'.

2. Apply the patch at the end of this file (after CUT HERE) to the libev source

3. In the libev directory
  a. autoreconf -i
  b. ./configure CFLAGS="$CFLAGS -Dinline_size= -DEV_MINPRI=0 -DEV_MAXPRI=0"
  c. install normally

4. Configure trafffic server with '--enable-libev'.


------------------------ CUT HERE ----------------
Index: ev.c
===================================================================
RCS file: /schmorpforge/libev/ev.c,v
retrieving revision 1.320
diff -u -r1.320 ev.c
--- ev.c	4 Dec 2009 20:25:06 -0000	1.320
+++ ev.c	25 Feb 2010 17:24:18 -0000
@@ -467,7 +467,9 @@
 
 #define expect_false(expr) expect ((expr) != 0, 0)
 #define expect_true(expr)  expect ((expr) != 0, 1)
+#ifndef inline_size
 #define inline_size        static inline
+#endif
 
 #if EV_MINIMAL
 # define inline_speed      static noinline
Index: ev_poll.c
===================================================================
RCS file: /schmorpforge/libev/ev_poll.c,v
retrieving revision 1.31
diff -u -r1.31 ev_poll.c
--- ev_poll.c	19 Jul 2009 04:11:27 -0000	1.31
+++ ev_poll.c	25 Feb 2010 17:24:18 -0000
@@ -104,12 +104,12 @@
       else if (errno != EINTR)
         ev_syserr ("(libev) poll");
     }
-  else
-    for (p = polls; res; ++p)
+  else {
+    int i = 0;
+    for (i = 0; i < pollcnt; i++) {
+      p = &polls[i];
       if (expect_false (p->revents)) /* this expect is debatable */
         {
-          --res;
-
           if (expect_false (p->revents & POLLNVAL))
             fd_kill (EV_A_ p->fd);
           else
@@ -120,6 +120,8 @@
               | (p->revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0)
             );
         }
+      }
+  }
 }
 
 int inline_size
