ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.354 by root, Fri Oct 22 09:24:11 2010 UTC vs.
Revision 1.355 by root, Fri Oct 22 10:09:12 2010 UTC

523# include "ev_win32.c" 523# include "ev_win32.c"
524#endif 524#endif
525 525
526/*****************************************************************************/ 526/*****************************************************************************/
527 527
528static unsigned int noinline
529ev_linux_version (void)
530{
531#ifdef __linux
532 struct utsname buf;
533 unsigned int v;
534 int i;
535 char *p = buf.release;
536
537 if (uname (&buf))
538 return 0;
539
540 for (i = 3+1; --i; )
541 {
542 unsigned int c = 0;
543
544 for (;;)
545 {
546 if (*p >= '0' && *p <= '9')
547 c = c * 10 + *p++ - '0';
548 else
549 {
550 p += *p == '.';
551 break;
552 }
553 }
554
555 v = (v << 8) | c;
556 }
557
558 return v;
559#else
560 return 0;
561#endif
562}
563
564/*****************************************************************************/
565
528#if EV_AVOID_STDIO 566#if EV_AVOID_STDIO
529static void noinline 567static void noinline
530ev_printerr (const char *msg) 568ev_printerr (const char *msg)
531{ 569{
532 write (STDERR_FILENO, msg, strlen (msg)); 570 write (STDERR_FILENO, msg, strlen (msg));
1530ev_embeddable_backends (void) 1568ev_embeddable_backends (void)
1531{ 1569{
1532 int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT; 1570 int flags = EVBACKEND_EPOLL | EVBACKEND_KQUEUE | EVBACKEND_PORT;
1533 1571
1534 /* epoll embeddability broken on all linux versions up to at least 2.6.23 */ 1572 /* epoll embeddability broken on all linux versions up to at least 2.6.23 */
1535 /* please fix it and tell me how to detect the fix */ 1573 if (ev_linux_version () < 0x020620) /* disable it on linux < 2.6.32 */
1536 flags &= ~EVBACKEND_EPOLL; 1574 flags &= ~EVBACKEND_EPOLL;
1537 1575
1538 return flags; 1576 return flags;
1539} 1577}
1540 1578
1541unsigned int 1579unsigned int
3048 { 3086 {
3049 struct inotify_event *ev = (struct inotify_event *)(buf + ofs); 3087 struct inotify_event *ev = (struct inotify_event *)(buf + ofs);
3050 infy_wd (EV_A_ ev->wd, ev->wd, ev); 3088 infy_wd (EV_A_ ev->wd, ev->wd, ev);
3051 ofs += sizeof (struct inotify_event) + ev->len; 3089 ofs += sizeof (struct inotify_event) + ev->len;
3052 } 3090 }
3053}
3054
3055inline_size unsigned int
3056ev_linux_version (void)
3057{
3058 struct utsname buf;
3059 unsigned int v;
3060 int i;
3061 char *p = buf.release;
3062
3063 if (uname (&buf))
3064 return 0;
3065
3066 for (i = 3+1; --i; )
3067 {
3068 unsigned int c = 0;
3069
3070 for (;;)
3071 {
3072 if (*p >= '0' && *p <= '9')
3073 c = c * 10 + *p++ - '0';
3074 else
3075 {
3076 p += *p == '.';
3077 break;
3078 }
3079 }
3080
3081 v = (v << 8) | c;
3082 }
3083
3084 return v;
3085} 3091}
3086 3092
3087inline_size void 3093inline_size void
3088ev_check_2625 (EV_P) 3094ev_check_2625 (EV_P)
3089{ 3095{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines