passenger's modification to libeio

Orion Poplawski orion at cora.nwra.com
Wed Apr 22 23:31:30 CEST 2015


phusion passenger 5.0.6 ships a modified libeio 4.15.  Fedora builds it
against system libeio, so this fails due to missing symbols.  The full diff is:

diff -ru ../libev/libev-4.15/ev.c passenger-5.0.6/ext/libev/ev.c
--- ../libev/libev-4.15/ev.c    2013-03-01 04:10:48.000000000 -0700
+++ passenger-5.0.6/ext/libev/ev.c      2013-10-26 16:00:00.000000000 -0600
@@ -967,7 +967,7 @@
   #define ecb_unreachable() __builtin_unreachable ()
 #else
   /* this seems to work fine, but gcc always emits a warning for it :/ */
-  ecb_inline void ecb_unreachable (void) ecb_noreturn;
+  ecb_inline ecb_noreturn void ecb_unreachable (void);
   ecb_inline void ecb_unreachable (void) { }
 #endif

@@ -2477,6 +2477,18 @@
   return backend;
 }

+int
+ev_backend_fd (EV_P) EV_THROW
+{
+  return backend_fd;
+}
+
+int
+ev_loop_get_pipe (EV_P_ unsigned int index) EV_THROW
+{
+  return evpipe[index];
+}
+
 #if EV_FEATURE_API
 unsigned int
 ev_iteration (EV_P) EV_THROW
diff -ru ../libev/libev-4.15/ev.h passenger-5.0.6/ext/libev/ev.h
--- ../libev/libev-4.15/ev.h    2013-03-01 04:05:29.000000000 -0700
+++ passenger-5.0.6/ext/libev/ev.h      2013-10-26 16:00:00.000000000 -0600
@@ -605,6 +605,9 @@

 EV_API_DECL unsigned int ev_backend (EV_P) EV_THROW; /* backend in use by loop */

+EV_API_DECL int ev_backend_fd (EV_P) EV_THROW;
+EV_API_DECL int ev_loop_get_pipe (EV_P_ unsigned int index) EV_THROW;
+
 EV_API_DECL void ev_now_update (EV_P) EV_THROW; /* update event loop time */

 #if EV_WALK_ENABLE


Changes appear to be part of this commit:
https://github.com/phusion/passenger/commit/a84b6ae1a64d2ae552d3e03c69d295a166200cd0#diff-8644f07c5dc22ffd1d2cae715cbbae56

	throw RuntimeException("Cannot create an event loop");
 	}

+	P_LOG_FILE_DESCRIPTOR_OPEN2(ev_backend_fd(loop), "libev event loop: backend
FD");
+
 	async = (ev_async *) malloc(sizeof(ev_async));
 	async->data = this;
 	ev_async_init(async, signalBackgroundEventLoopExit);
 	ev_async_start(loop, async);
+	P_LOG_FILE_DESCRIPTOR_OPEN2(ev_loop_get_pipe(loop, 0), "libev event loop:
async pipe 0");
+	P_LOG_FILE_DESCRIPTOR_OPEN2(ev_loop_get_pipe(loop, 1), "libev event loop:
async pipe 1");
 	safe = boost::make_shared<SafeLibev>(loop);
 	priv = new BackgroundEventLoopPrivate();
priv->thr = NULL;


~SafeLibev() {
 		destroy();
+		P_LOG_FILE_DESCRIPTOR_CLOSE(ev_loop_get_pipe(loop, 0));
+		P_LOG_FILE_DESCRIPTOR_CLOSE(ev_loop_get_pipe(loop, 1));
+		P_LOG_FILE_DESCRIPTOR_CLOSE(ev_backend_fd(loop));
 		ev_loop_destroy(loop);
}

Which allows for some additional logging of fd opening/closing.  I know
nothing about the motivation for this change, but I'm wondering if this would
be accepted by libev?

Thanks for your time.


-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion at nwra.com
Boulder, CO 80301                   http://www.nwra.com



More information about the libev mailing list