diff options
author | root <root> | 2010-10-22 10:09:12 +0000 |
---|---|---|
committer | root <root> | 2010-10-22 10:09:12 +0000 |
commit | 84cd5c8b8c9bab9e2e9ad5a69cfc2818abc3ae0f (patch) | |
tree | 3cf0eb1ca13d6543229f8691756dba3566628b7d | |
parent | 2ecadb3192c0928dc5381336774e54d4019e28de (diff) |
*** empty log message ***
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | ev.c | 74 | ||||
-rw-r--r-- | ev.pod | 8 |
3 files changed, 45 insertions, 38 deletions
@@ -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 @@ -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) { @@ -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. |