Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Upgrade to libev 4.04

  • Loading branch information...
commit f3b96ebd5d7a4f2409f402837e550f219cc1cb0a 1 parent a8734e6
Tony Arcieri authored
1  CHANGES.md
View
@@ -8,6 +8,7 @@
* Refactor StatWatcher to pass pervious and current path state ala Node.js
* spec:valgrind Rake task to run specs under valgrind
* Use rake-compiler to build cool.io
+* Upgrade to libev 4.04
1.0.0
-----
24 ext/libev/Changes
View
@@ -1,5 +1,29 @@
Revision history for libev, a high-performance and full-featured event loop.
+4.04 Wed Feb 16 09:01:51 CET 2011
+ - fix two problems in the native win32 backend, where reuse of fd's
+ with different underlying handles caused handles not to be removed
+ or added to the select set (analyzed and tested by Bert Belder).
+ - do no rely on ceil() in ev_e?poll.c.
+ - backport libev to HP-UX versions before 11 v3.
+ - configure did not detect nanosleep and clock_gettime properly when
+ they are available in the libc (as opposed to -lrt).
+
+4.03 Tue Jan 11 14:37:25 CET 2011
+ - officially support polling files with all backends.
+ - support files, /dev/zero etc. the same way as select in the epoll
+ backend, by generating events on our own.
+ - ports backend: work around solaris bug 6874410 and many related ones
+ (EINTR, maybe more), with no performance loss (note that the solaris
+ bug report is actually wrong, reality is far more bizarre and broken
+ than that).
+ - define EV_READ/EV_WRITE as macros in event.h, as some programs use
+ #ifdef to test for them.
+ - new (experimental) function: ev_feed_signal.
+ - new (to become default) EVFLAG_NOSIGMASK flag.
+ - new EVBACKEND_MASK symbol.
+ - updated COMMON IDIOMS SECTION.
+
4.01 Fri Nov 5 21:51:29 CET 2010
- automake fucked it up, apparently, --add-missing -f is not quite enough
to make it update its files, so 4.00 didn't install ev++.h and
110 ext/libev/ev.c
View
@@ -1,19 +1,19 @@
/*
* libev event processing core, watcher management
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -378,7 +378,8 @@ EV_CPP(extern "C" {)
#endif
#if !EV_USE_NANOSLEEP
-# ifndef _WIN32
+/* hp-ux has it in sys/time.h, which we unconditionally include above */
+# if !defined(_WIN32) && !defined(__hpux)
# include <sys/select.h>
# endif
#endif
@@ -817,6 +818,14 @@ ev_sleep (ev_tstamp delay)
}
}
+inline_speed int
+ev_timeout_to_ms (ev_tstamp timeout)
+{
+ int ms = timeout * 1000. + .999999;
+
+ return expect_true (ms) ? ms : timeout < 1e-6 ? 0 : 1;
+}
+
/*****************************************************************************/
#define MALLOC_ROUND 4096 /* prefer to allocate in chunks of this size, must be 2**n and >> 4 longs */
@@ -967,6 +976,31 @@ fd_reify (EV_P)
{
int i;
+#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
+ for (i = 0; i < fdchangecnt; ++i)
+ {
+ int fd = fdchanges [i];
+ ANFD *anfd = anfds + fd;
+
+ if (anfd->reify & EV__IOFDSET)
+ {
+ SOCKET handle = EV_FD_TO_WIN32_HANDLE (fd);
+
+ if (handle != anfd->handle)
+ {
+ unsigned long arg;
+
+ assert (("libev: only socket fds supported in this configuration", ioctlsocket (handle, FIONREAD, &arg) == 0));
+
+ /* handle changed, but fd didn't - we need to do it in two steps */
+ backend_modify (EV_A_ fd, anfd->events, 0);
+ anfd->events = 0;
+ anfd->handle = handle;
+ }
+ }
+ }
+#endif
+
for (i = 0; i < fdchangecnt; ++i)
{
int fd = fdchanges [i];
@@ -978,16 +1012,6 @@ fd_reify (EV_P)
anfd->reify = 0;
-#if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP
- if (o_reify & EV__IOFDSET)
- {
- unsigned long arg;
- anfd->handle = EV_FD_TO_WIN32_HANDLE (fd);
- assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0));
- printf ("oi %d %x\n", fd, anfd->handle);//D
- }
-#endif
-
/*if (expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */
{
anfd->events = 0;
@@ -1345,14 +1369,16 @@ pipecb (EV_P_ ev_io *iow, int revents)
read (evpipe [0], &dummy, 1);
}
+#if EV_SIGNAL_ENABLE
if (sig_pending)
- {
+ {
sig_pending = 0;
for (i = EV_NSIG - 1; i--; )
if (expect_false (signals [i].pending))
ev_feed_signal_event (EV_A_ i + 1);
}
+#endif
#if EV_ASYNC_ENABLE
if (async_pending)
@@ -1371,19 +1397,28 @@ pipecb (EV_P_ ev_io *iow, int revents)
/*****************************************************************************/
-static void
-ev_sighandler (int signum)
+void
+ev_feed_signal (int signum)
{
#if EV_MULTIPLICITY
EV_P = signals [signum - 1].loop;
+
+ if (!EV_A)
+ return;
#endif
+ signals [signum - 1].pending = 1;
+ evpipe_write (EV_A_ &sig_pending);
+}
+
+static void
+ev_sighandler (int signum)
+{
#ifdef _WIN32
signal (signum, ev_sighandler);
#endif
- signals [signum - 1].pending = 1;
- evpipe_write (EV_A_ &sig_pending);
+ ev_feed_signal (signum);
}
void noinline
@@ -1645,6 +1680,8 @@ loop_init (EV_P_ unsigned int flags)
{
if (!backend)
{
+ origflags = flags;
+
#if EV_USE_REALTIME
if (!have_realtime)
{
@@ -1699,7 +1736,7 @@ loop_init (EV_P_ unsigned int flags)
sigfd = flags & EVFLAG_SIGNALFD ? -2 : -1;
#endif
- if (!(flags & 0x0000ffffU))
+ if (!(flags & EVBACKEND_MASK))
flags |= ev_recommended_backends ();
#if EV_USE_IOCP
@@ -2102,9 +2139,6 @@ ev_invoke_pending (EV_P)
{
ANPENDING *p = pendings [pri] + --pendingcnt [pri];
- /*assert (("libev: non-pending watcher on pending list", p->w->pending));*/
- /* ^ this is no longer true, as pending_w could be here */
-
p->w->pending = 0;
EV_CB_INVOKE (p->w, p->events);
EV_FREQUENT_CHECK;
@@ -2175,6 +2209,15 @@ timers_reify (EV_P)
}
#if EV_PERIODIC_ENABLE
+
+inline_speed void
+periodic_recalc (EV_P_ ev_periodic *w)
+{
+ /* TODO: use slow but potentially more correct incremental algo, */
+ /* also do not rely on ceil */
+ ev_at (w) = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval;
+}
+
/* make periodics pending */
inline_size void
periodics_reify (EV_P)
@@ -2203,7 +2246,8 @@ periodics_reify (EV_P)
}
else if (w->interval)
{
- ev_at (w) = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval;
+ periodic_recalc (EV_A_ w);
+
/* if next trigger time is not sufficiently in the future, put it there */
/* this might happen because of floating point inexactness */
if (ev_at (w) - ev_rt_now < TIME_EPSILON)
@@ -2247,7 +2291,7 @@ periodics_reschedule (EV_P)
if (w->reschedule_cb)
ev_at (w) = w->reschedule_cb (w, ev_rt_now);
else if (w->interval)
- ev_at (w) = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval;
+ periodic_recalc (EV_A_ w);
ANHE_at_cache (periodics [i]);
}
@@ -2749,8 +2793,7 @@ ev_periodic_start (EV_P_ ev_periodic *w)
else if (w->interval)
{
assert (("libev: ev_periodic_start called with negative interval value", w->interval >= 0.));
- /* this formula differs from the one in periodic_reify because we do not always round up */
- ev_at (w) = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval;
+ periodic_recalc (EV_A_ w);
}
else
ev_at (w) = w->offset;
@@ -2881,9 +2924,12 @@ ev_signal_start (EV_P_ ev_signal *w)
sa.sa_flags = SA_RESTART; /* if restarting works we save one iteration */
sigaction (w->signum, &sa, 0);
- sigemptyset (&sa.sa_mask);
- sigaddset (&sa.sa_mask, w->signum);
- sigprocmask (SIG_UNBLOCK, &sa.sa_mask, 0);
+ if (origflags & EVFLAG_NOSIGMASK)
+ {
+ sigemptyset (&sa.sa_mask);
+ sigaddset (&sa.sa_mask, w->signum);
+ sigprocmask (SIG_UNBLOCK, &sa.sa_mask, 0);
+ }
#endif
}
@@ -3034,7 +3080,7 @@ infy_add (EV_P_ ev_stat *w)
*pend = 0;
w->wd = inotify_add_watch (fs_fd, path, mask);
- }
+ }
while (w->wd < 0 && (errno == ENOENT || errno == EACCES));
}
}
19 ext/libev/ev.h
View
@@ -1,19 +1,19 @@
/*
* libev native API header
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -185,7 +185,7 @@ struct ev_loop;
# define EV_INLINE static
#endif
-/* EV_PROTOTYPES can be sued to switch of prototype declarations */
+/* EV_PROTOTYPES can be used to switch of prototype declarations */
#ifndef EV_PROTOTYPES
# define EV_PROTOTYPES 1
#endif
@@ -193,7 +193,7 @@ struct ev_loop;
/*****************************************************************************/
#define EV_VERSION_MAJOR 4
-#define EV_VERSION_MINOR 1
+#define EV_VERSION_MINOR 4
/* eventmask, revents, events... */
enum {
@@ -491,7 +491,8 @@ enum {
#if EV_COMPAT3
EVFLAG_NOSIGFD = 0, /* compatibility to pre-3.9 */
#endif
- EVFLAG_SIGNALFD = 0x00200000U /* attempt to use signalfd */
+ EVFLAG_SIGNALFD = 0x00200000U, /* attempt to use signalfd */
+ EVFLAG_NOSIGMASK = 0x00400000U /* avoid modifying the signal mask */
};
/* method bits to be ored together */
@@ -502,7 +503,8 @@ enum {
EVBACKEND_KQUEUE = 0x00000008U, /* bsd */
EVBACKEND_DEVPOLL = 0x00000010U, /* solaris 8 */ /* NYI */
EVBACKEND_PORT = 0x00000020U, /* solaris 10 */
- EVBACKEND_ALL = 0x0000003FU
+ EVBACKEND_ALL = 0x0000003FU, /* all known backends */
+ EVBACKEND_MASK = 0x0000FFFFU /* all future backends */
};
#if EV_PROTOTYPES
@@ -720,6 +722,7 @@ void ev_resume (EV_P);
void ev_feed_event (EV_P_ void *w, int revents);
void ev_feed_fd_event (EV_P_ int fd, int revents);
#if EV_SIGNAL_ENABLE
+void ev_feed_signal (int signum);
void ev_feed_signal_event (EV_P_ int signum);
#endif
void ev_invoke (EV_P_ void *w, int revents);
46 ext/libev/ev_epoll.c
View
@@ -1,19 +1,19 @@
/*
* libev epoll fd activity backend
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -53,7 +53,8 @@
* (such as files). while not critical, no other advanced interface
* seems to share this (rather non-unixy) limitation.
* e) epoll claims to be embeddable, but in practise you never get
- * a ready event for the epoll fd.
+ * a ready event for the epoll fd (broken: <=2.6.26, working: >=2.6.32).
+ * f) epoll_ctl returning EPERM means the fd is always ready.
*
* lots of "weird code" and complication handling in this file is due
* to these design problems with epoll, as we try very hard to avoid
@@ -64,6 +65,8 @@
#include <sys/epoll.h>
+#define EV_EMASK_EPERM 0x80
+
static void
epoll_modify (EV_P_ int fd, int oev, int nev)
{
@@ -112,6 +115,21 @@ epoll_modify (EV_P_ int fd, int oev, int nev)
if (!epoll_ctl (backend_fd, EPOLL_CTL_MOD, fd, &ev))
return;
}
+ else if (expect_true (errno == EPERM))
+ {
+ /* EPERM means the fd is always ready, but epoll is too snobbish */
+ /* to handle it, unlike select or poll. */
+ anfds [fd].emask = EV_EMASK_EPERM;
+
+ /* add fd to epoll_eperms, if not already inside */
+ if (!(oldmask & EV_EMASK_EPERM))
+ {
+ array_needsize (int, epoll_eperms, epoll_epermmax, epoll_epermcnt + 1, EMPTY2);
+ epoll_eperms [epoll_epermcnt++] = fd;
+ }
+
+ return;
+ }
fd_kill (EV_A_ fd);
@@ -125,11 +143,12 @@ epoll_poll (EV_P_ ev_tstamp timeout)
{
int i;
int eventcnt;
-
+
/* epoll wait times cannot be larger than (LONG_MAX - 999UL) / HZ msecs, which is below */
/* the default libev max wait time, however. */
EV_RELEASE_CB;
- eventcnt = epoll_wait (backend_fd, epoll_events, epoll_eventmax, (int)ceil (timeout * 1000.));
+ eventcnt = epoll_wait (backend_fd, epoll_events, epoll_eventmax,
+ epoll_epermcnt ? 0 : ev_timeout_to_ms (timeout));
EV_ACQUIRE_CB;
if (expect_false (eventcnt < 0))
@@ -186,6 +205,18 @@ epoll_poll (EV_P_ ev_tstamp timeout)
epoll_eventmax = array_nextsize (sizeof (struct epoll_event), epoll_eventmax, epoll_eventmax + 1);
epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax);
}
+
+ /* now synthesize events for all fds where epoll fails, while select works... */
+ for (i = epoll_epermcnt; i--; )
+ {
+ int fd = epoll_eperms [i];
+ unsigned char events = anfds [fd].events & (EV_READ | EV_WRITE);
+
+ if (anfds [fd].emask & EV_EMASK_EPERM && events)
+ fd_event (EV_A_ fd, events);
+ else
+ epoll_eperms [i] = epoll_eperms [--epoll_epermcnt];
+ }
}
int inline_size
@@ -217,6 +248,7 @@ void inline_size
epoll_destroy (EV_P)
{
ev_free (epoll_events);
+ array_free (epoll_eperm, EMPTY);
}
void inline_size
10 ext/libev/ev_kqueue.c
View
@@ -6,14 +6,14 @@
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -103,12 +103,12 @@ kqueue_poll (EV_P_ ev_tstamp timeout)
kqueue_changecnt = 0;
if (expect_false (res < 0))
- {
+ {
if (errno != EINTR)
ev_syserr ("(libev) kevent");
return;
- }
+ }
for (i = 0; i < res; ++i)
{
10 ext/libev/ev_poll.c
View
@@ -1,19 +1,19 @@
/*
* libev poll fd activity backend
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -92,7 +92,7 @@ poll_poll (EV_P_ ev_tstamp timeout)
int res;
EV_RELEASE_CB;
- res = poll (polls, pollcnt, (int)ceil (timeout * 1000.));
+ res = poll (polls, pollcnt, ev_timeout_to_ms (timeout));
EV_ACQUIRE_CB;
if (expect_false (res < 0))
37 ext/libev/ev_port.c
View
@@ -1,19 +1,19 @@
/*
* libev solaris event port backend
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -37,6 +37,17 @@
* either the BSD or the GPL.
*/
+/* useful reading:
+ *
+ * http://bugs.opensolaris.org/view_bug.do?bug_id=6268715 (random results)
+ * http://bugs.opensolaris.org/view_bug.do?bug_id=6455223 (just totally broken)
+ * http://bugs.opensolaris.org/view_bug.do?bug_id=6873782 (manpage ETIME)
+ * http://bugs.opensolaris.org/view_bug.do?bug_id=6874410 (implementation ETIME)
+ * http://www.mail-archive.com/networking-discuss@opensolaris.org/msg11898.html ETIME vs. nget
+ * http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/event_port.c (libc)
+ * http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/fs/portfs/port.c#1325 (kernel)
+ */
+
#include <sys/types.h>
#include <sys/time.h>
#include <poll.h>
@@ -85,18 +96,20 @@ port_poll (EV_P_ ev_tstamp timeout)
struct timespec ts;
uint_t nget = 1;
+ /* we initialise this to something we will skip in the loop, as */
+ /* port_getn can return with nget unchanged, but no indication */
+ /* whether it was the original value or has been updated :/ */
+ port_events [0].portev_source = 0;
+
EV_RELEASE_CB;
EV_TS_SET (ts, timeout);
res = port_getn (backend_fd, port_events, port_eventmax, &nget, &ts);
EV_ACQUIRE_CB;
- if (res == -1)
- {
- if (errno != EINTR && errno != ETIME)
- ev_syserr ("(libev) port_getn (see http://bugs.opensolaris.org/view_bug.do?bug_id=6268715, try LIBEV_FLAGS=3 env variable)");
-
- return;
- }
+ /* port_getn may or may not set nget on error */
+ /* so we rely on port_events [0].portev_source not being updated */
+ if (res == -1 && errno != ETIME && errno != EINTR)
+ ev_syserr ("(libev) port_getn (see http://bugs.opensolaris.org/view_bug.do?bug_id=6268715, try LIBEV_FLAGS=3 env variable)");
for (i = 0; i < nget; ++i)
{
@@ -130,6 +143,8 @@ port_init (EV_P_ int flags)
if ((backend_fd = port_create ()) < 0)
return 0;
+ assert (("libev: PORT_SOURCE_FD must not be zero", PORT_SOURCE_FD));
+
fcntl (backend_fd, F_SETFD, FD_CLOEXEC); /* not sure if necessary, hopefully doesn't hurt */
backend_fudge = 1e-3; /* needed to compensate for port_getn returning early */
19 ext/libev/ev_select.c
View
@@ -6,14 +6,14 @@
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -39,8 +39,11 @@
#ifndef _WIN32
/* for unix systems */
-# include <sys/select.h>
# include <inttypes.h>
+# ifndef __hpux
+/* for REAL unix systems */
+# include <sys/select.h>
+# endif
#endif
#ifndef EV_SELECT_USE_FD_SET
@@ -280,10 +283,10 @@ select_init (EV_P_ int flags)
#endif
#else
vec_max = 0;
- vec_ri = 0;
- vec_ro = 0;
- vec_wi = 0;
- vec_wo = 0;
+ vec_ri = 0;
+ vec_ro = 0;
+ vec_wi = 0;
+ vec_wo = 0;
#ifdef _WIN32
vec_eo = 0;
#endif
14 ext/libev/ev_vars.h
View
@@ -1,19 +1,19 @@
/*
* loop member variable declarations
*
- * Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
+ * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -102,6 +102,9 @@ VARx(int, pollidxmax)
#if EV_USE_EPOLL || EV_GENWRAP
VARx(struct epoll_event *, epoll_events)
VARx(int, epoll_eventmax)
+VARx(int *, epoll_eperms)
+VARx(int, epoll_epermcnt)
+VARx(int, epoll_epermmax)
#endif
#if EV_USE_KQUEUE || EV_GENWRAP
@@ -177,12 +180,15 @@ VAR (fs_hash, ANFS fs_hash [EV_INOTIFY_HASHSIZE])
#endif
VARx(EV_ATOMIC_T, sig_pending)
+VARx(int, nosigmask)
#if EV_USE_SIGNALFD || EV_GENWRAP
VARx(int, sigfd)
VARx(ev_io, sigfd_w)
VARx(sigset_t, sigfd_set)
#endif
+VARx(unsigned int, origflags) /* original loop flags */
+
#if EV_FEATURE_API || EV_GENWRAP
VARx(unsigned int, loop_count) /* total number of loop iterations/blocks */
VARx(unsigned int, loop_depth) /* #ev_run enters - #ev_run leaves */
12 ext/libev/ev_win32.c
View
@@ -6,14 +6,14 @@
*
* Redistribution and use in source and binary forms, with or without modifica-
* tion, are permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
* CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
@@ -46,7 +46,7 @@
/* MSDN says this is required to handle SIGFPE */
/* my wild guess would be that using something floating-pointy is required */
/* for the crt to do something about it */
-volatile double SIGFPE_REQ = 0.0f;
+volatile double SIGFPE_REQ = 0.0f;
/* oh, the humanity! */
static int
@@ -59,7 +59,7 @@ ev_pipe (int filedes [2])
SOCKET listener;
SOCKET sock [2] = { -1, -1 };
- if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
+ if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
return -1;
addr.sin_family = AF_INET;
@@ -75,7 +75,7 @@ ev_pipe (int filedes [2])
if (listen (listener, 1))
goto fail;
- if ((sock [0] = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
+ if ((sock [0] = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
goto fail;
if (connect (sock [0], (struct sockaddr *)&addr, addr_size))
10 ext/libev/ev_wrap.h
View
@@ -40,6 +40,9 @@
#define pollidxmax ((loop)->pollidxmax)
#define epoll_events ((loop)->epoll_events)
#define epoll_eventmax ((loop)->epoll_eventmax)
+#define epoll_eperms ((loop)->epoll_eperms)
+#define epoll_epermcnt ((loop)->epoll_epermcnt)
+#define epoll_epermmax ((loop)->epoll_epermmax)
#define kqueue_changes ((loop)->kqueue_changes)
#define kqueue_changemax ((loop)->kqueue_changemax)
#define kqueue_changecnt ((loop)->kqueue_changecnt)
@@ -82,9 +85,11 @@
#define fs_2625 ((loop)->fs_2625)
#define fs_hash ((loop)->fs_hash)
#define sig_pending ((loop)->sig_pending)
+#define nosigmask ((loop)->nosigmask)
#define sigfd ((loop)->sigfd)
#define sigfd_w ((loop)->sigfd_w)
#define sigfd_set ((loop)->sigfd_set)
+#define origflags ((loop)->origflags)
#define loop_count ((loop)->loop_count)
#define loop_depth ((loop)->loop_depth)
#define userdata ((loop)->userdata)
@@ -132,6 +137,9 @@
#undef pollidxmax
#undef epoll_events
#undef epoll_eventmax
+#undef epoll_eperms
+#undef epoll_epermcnt
+#undef epoll_epermmax
#undef kqueue_changes
#undef kqueue_changemax
#undef kqueue_changecnt
@@ -174,9 +182,11 @@
#undef fs_2625
#undef fs_hash
#undef sig_pending
+#undef nosigmask
#undef sigfd
#undef sigfd_w
#undef sigfd_set
+#undef origflags
#undef loop_count
#undef loop_depth
#undef userdata
Please sign in to comment.
Something went wrong with that request. Please try again.