summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes1
-rw-r--r--ev.c74
-rw-r--r--ev.pod8
3 files changed, 45 insertions, 38 deletions
diff --git a/Changes b/Changes
index 3aaaa77..2505e26 100644
--- a/Changes
+++ b/Changes
@@ -24,6 +24,7 @@ TODO: EVRUN_XXX?
not to need it (helpfully pointed out by Tilghman Lesher).
- do not use poll by default on freebsd, it's broken (what isn't
on freebsd...).
+ - allow to embed epoll on kernels >= 2.6.32.
- configure now prepends -O3, not appends it, so one can still
override it.
- ev.pod: greatly expanded the portability section, added a porting
diff --git a/ev.c b/ev.c
index a8ab136..1dc9c45 100644
--- a/ev.c
+++ b/ev.c
@@ -525,6 +525,44 @@ static EV_ATOMIC_T have_monotonic; /* did clock_gettime (CLOCK_MONOTONIC) work?
/*****************************************************************************/
+static unsigned int noinline
+ev_linux_version (void)
+{
+#ifdef __linux
+ struct utsname buf;
+ unsigned int v;
+ int i;
+ char *p = buf.release;
+
+ if (uname (&buf))
+ return 0;
+
+ for (i = 3+1; --i; )
+ {
+ unsigned int c = 0;
+
+ for (;;)
+ {
+ if (*p >= '0' && *p <= '9')
+ c = c * 10 + *p++ - '0';
+ else
+ {
+ p += *p == '.';
+ break;
+ }
+ }
+
+ v = (v << 8) | c;
+ }
+
+ return v;
+#else
+ return 0;
+#endif
+}
+
+/*****************************************************************************/
+
#if EV_AVOID_STDIO
static void noinline
ev_printerr (const char *msg)
@@ -1532,8 +1570,8 @@ ev_embeddable_backends (void)
int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT;
/* epoll embeddability broken on all linux versions up to at least 2.6.23 */
- /* please fix it and tell me how to detect the fix */
- flags &= ~EVBACKEND_EPOLL;
+ if (ev_linux_version () < 0x020620) /* disable it on linux < 2.6.32 */
+ flags &= ~EVBACKEND_EPOLL;
return flags;
}
@@ -3052,38 +3090,6 @@ infy_cb (EV_P_ ev_io *w, int revents)
}
}
-inline_size unsigned int
-ev_linux_version (void)
-{
- struct utsname buf;
- unsigned int v;
- int i;
- char *p = buf.release;
-
- if (uname (&buf))
- return 0;
-
- for (i = 3+1; --i; )
- {
- unsigned int c = 0;
-
- for (;;)
- {
- if (*p >= '0' && *p <= '9')
- c = c * 10 + *p++ - '0';
- else
- {
- p += *p == '.';
- break;
- }
- }
-
- v = (v << 8) | c;
- }
-
- return v;
-}
-
inline_size void
ev_check_2625 (EV_P)
{
diff --git a/ev.pod b/ev.pod
index 1e73ce3..50270ed 100644
--- a/ev.pod
+++ b/ev.pod
@@ -227,10 +227,10 @@ probe for if you specify no backends explicitly.
=item unsigned int ev_embeddable_backends ()
Returns the set of backends that are embeddable in other event loops. This
-is the theoretical, all-platform, value. To find which backends
-might be supported on the current system, you would need to look at
-C<ev_embeddable_backends () & ev_supported_backends ()>, likewise for
-recommended ones.
+value is platform-specific but can include backends not available on the
+current system. To find which embeddable backends might be supported on
+the current system, you would need to look at C<ev_embeddable_backends ()
+& ev_supported_backends ()>, likewise for recommended ones.
See the description of C<ev_embed> watchers for more info.