Commit 654329ef authored by Denis Bilenko's avatar Denis Bilenko

update libev to latest CVS + our patches:

 - install SIGCHLD lazily when first child watcher started
 - properly call WSARecv
 - log WSARecv's and WSASend's errors;
 - install periodic timer for waitpid()
 - ev_loop_destroy(): do not stop childev watcher when destroing non-default loop
parent ecb22bfc
Revision history for libev, a high-performance and full-featured event loop. Revision history for libev, a high-performance and full-featured event loop.
TODO: ev_loop_wakeup TODO: ev_loop_wakeup
TODO: EV_NO_THREADS/NO_SMP and/or EV_USE_PTHREADS or so. also document.
TODO: #define EV_API_DECL static? ev_default_loop_ptr?
TODO: EV_STANDALONE == NO_HASSEL (do not use clock_gettime in ev_standalone) TODO: EV_STANDALONE == NO_HASSEL (do not use clock_gettime in ev_standalone)
TODO: memory fences for clang TODO: faq, process a thing in each iteration
4.10 TODO: dbeugging tips, ev_verify, ev_init twice
- queueing pending watchers of higher priority from a watcher now invokes
them in a timely fashion (reported by Denis Bilenko).
- add throw() to all libev functions that cannot throw exceptions, for
further code size decrease when compiling for C++.
- add throw () to callbacks that must not throw exceptions (allocator,
syserr, loop acquire/release, periodic reschedule cbs).
- fix event_base_loop return code, add event_get_callback, event_base_new,
event_base_get_method calls to improve libevent 1.x emulation and add
some libevent 2.x funcitonality (based on a patch by Jeff Davey).
- add more memory fences to fix a bug reported by Jeff Davey. Better
be overfenced than underprotected.
- ev_run now returns a boolean status (true meaning watchers are
still active).
- ev_once: undef EV_ERROR in ev_kqueue.c, to avoid clashing with
libev's EV_ERROR (reported by 191919).
- (ecb) add memory fence support for xlC (Darin McBride).
- (ecb) add memory fence support for gcc-mips (Anton Kirilov).
- (ecb) add memory fence support for gcc-alpha (Christian Weisgerber).
- work around some kernels losing file descriptors by leaking
the kqueue descriptor in the child.
- include sys/syscall.h instead of plain syscall.h.
- check for io watcher loops in ev_verify, check for the most
common reported usage bug in ev_io_start.
- chose socket vs. WSASocket at compiletime using EV_USE_WSASOCKET.
- always use WSASend/WSARecv directly on windows, hoping that this
works in all cases (unlike read/write/send/recv...).
4.11 Sat Feb 4 19:52:39 CET 2012
- INCOMPATIBLE CHANGE: ev_timer_again now clears the pending status, as
was documented already, but not implemented in the repeating case.
- new compiletime symbols: EV_NO_SMP and EV_NO_THREADS.
- fix a race where the workaround against the epoll fork bugs - fix a race where the workaround against the epoll fork bugs
caused signals to not be handled anymore. caused signals to not be handled anymore.
- correct backend_fudge for most backends, and implement a windows - correct backend_fudge for most backends, and implement a windows
...@@ -23,6 +52,14 @@ TODO: memory fences for clang ...@@ -23,6 +52,14 @@ TODO: memory fences for clang
- strategically import macros from libecb and mark rarely-used functions - strategically import macros from libecb and mark rarely-used functions
as cache-cold (saving almost 2k code size on typical amd64 setups). as cache-cold (saving almost 2k code size on typical amd64 setups).
- add Symbols.ev and Symbols.event files, that were missing. - add Symbols.ev and Symbols.event files, that were missing.
- fix backend_mintime value for epoll (was 1/1024, is 1/1000 now).
- fix #3 "be smart about timeouts" to not "deadlock" when
timeout == now, also improve the section overall.
- avoid "AVOIDING FINISHING BEFORE RETURNING" idiom.
- support new EV_API_STATIC mode to make all libev symbols
static.
- supply default CFLAGS of -g -O3 with gcc when original CFLAGS
were empty.
4.04 Wed Feb 16 09:01:51 CET 2011 4.04 Wed Feb 16 09:01:51 CET 2011
- fix two problems in the native win32 backend, where reuse of fd's - fix two problems in the native win32 backend, where reuse of fd's
......
All files in libev are Copyright (C)2007,2008,2009 Marc Alexander Lehmann. All files in libev are
Copyright (c)2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
......
...@@ -39,7 +39,7 @@ subdir = . ...@@ -39,7 +39,7 @@ subdir = .
DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \ DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure config.guess \ $(srcdir)/config.h.in $(top_srcdir)/configure config.guess \
config.sub depcomp install-sh ltmain.sh missing config.sub depcomp install-sh ltmain.sh missing mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/libev.m4 \ am__aclocal_m4_deps = $(top_srcdir)/libev.m4 \
$(top_srcdir)/configure.ac $(top_srcdir)/configure.ac
...@@ -47,7 +47,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ ...@@ -47,7 +47,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4) $(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
...@@ -766,6 +766,9 @@ uninstall-man: uninstall-man3 ...@@ -766,6 +766,9 @@ uninstall-man: uninstall-man3
uninstall-libLTLIBRARIES uninstall-man uninstall-man3 uninstall-libLTLIBRARIES uninstall-man uninstall-man3
ev.3: ev.pod
pod2man -n LIBEV -r "libev-$(VERSION)" -c "libev - high performance full featured event loop" -s3 <$< >$@
# Tell versions [3.59,3.63) of GNU make to not export all variables. # Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded. # Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: .NOEXPORT:
...@@ -24,23 +24,23 @@ ABOUT ...@@ -24,23 +24,23 @@ ABOUT
- relative timers/timeouts (handle time jumps). - relative timers/timeouts (handle time jumps).
- fast intra-thread communication between multiple - fast intra-thread communication between multiple
event loops (with optional fast linux eventfd backend). event loops (with optional fast linux eventfd backend).
- extremely easy to embed. - extremely easy to embed (fully documented, no dependencies,
- very small codebase, no bloated library. autoconf supported but optional).
- very small codebase, no bloated library, simple code.
- fully extensible by being able to plug into the event loop, - fully extensible by being able to plug into the event loop,
integrate other event loops, integrate other event loop users. integrate other event loops, integrate other event loop users.
- very little memory use (small watchers, small event loop data). - very little memory use (small watchers, small event loop data).
- optional C++ interface allowing method and function callbacks - optional C++ interface allowing method and function callbacks
at no extra memory or runtime overhead. at no extra memory or runtime overhead.
- optional Perl interface with similar characteristics (capable - optional Perl interface with similar characteristics (capable
of running Glib/Gtk2 on libev, interfaces with Net::SNMP and of running Glib/Gtk2 on libev).
libadns).
- support for other languages (multiple C++ interfaces, D, Ruby, - support for other languages (multiple C++ interfaces, D, Ruby,
Python) available from third-parties. Python) available from third-parties.
Examples of programs that embed libev: the EV perl module, Examples of programs that embed libev: the EV perl module, node.js,
rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the Deliantra MMORPG auditd, rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the
server (http://www.deliantra.net/), Rubinius (a next-generation Ruby Deliantra MMORPG server (http://www.deliantra.net/), Rubinius (a
VM), the Ebb web server, the Rev event toolkit. next-generation Ruby VM), the Ebb web server, the Rev event toolkit.
CONTRIBUTORS CONTRIBUTORS
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -247,7 +247,7 @@ epoll_init (EV_P_ int flags) ...@@ -247,7 +247,7 @@ epoll_init (EV_P_ int flags)
fcntl (backend_fd, F_SETFD, FD_CLOEXEC); fcntl (backend_fd, F_SETFD, FD_CLOEXEC);
backend_mintime = 1./1024.; /* epoll does sometimes return early, this is just to avoid the worst */ backend_mintime = 1e-3; /* epoll does sometimes return early, this is just to avoid the worst */
backend_modify = epoll_modify; backend_modify = epoll_modify;
backend_poll = epoll_poll; backend_poll = epoll_poll;
......
/* /*
* libev kqueue backend * libev kqueue backend
* *
* Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de> * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modifica- * Redistribution and use in source and binary forms, with or without modifica-
...@@ -155,7 +155,8 @@ kqueue_poll (EV_P_ ev_tstamp timeout) ...@@ -155,7 +155,8 @@ kqueue_poll (EV_P_ ev_tstamp timeout)
int inline_size int inline_size
kqueue_init (EV_P_ int flags) kqueue_init (EV_P_ int flags)
{ {
/* Initialize the kernel queue */ /* initialize the kernel queue */
kqueue_fd_pid = getpid ();
if ((backend_fd = kqueue ()) < 0) if ((backend_fd = kqueue ()) < 0)
return 0; return 0;
...@@ -185,8 +186,20 @@ kqueue_destroy (EV_P) ...@@ -185,8 +186,20 @@ kqueue_destroy (EV_P)
void inline_size void inline_size
kqueue_fork (EV_P) kqueue_fork (EV_P)
{ {
close (backend_fd); /* some BSD kernels don't just destroy the kqueue itself,
* but also close the fd, which isn't documented, and
* impossible to support properly.
* we remember the pid of the kqueue call and only close
* the fd if the pid is still the same.
* this leaks fds on sane kernels, but BSD interfaces are
* notoriously buggy and rarely get fixed.
*/
pid_t newpid = getpid ();
if (newpid == kqueue_fd_pid)
close (backend_fd);
kqueue_fd_pid = newpid;
while ((backend_fd = kqueue ()) < 0) while ((backend_fd = kqueue ()) < 0)
ev_syserr ("(libev) kqueue"); ev_syserr ("(libev) kqueue");
...@@ -196,3 +209,6 @@ kqueue_fork (EV_P) ...@@ -196,3 +209,6 @@ kqueue_fork (EV_P)
fd_rearm_all (EV_A); fd_rearm_all (EV_A);
} }
/* sys/event.h defines EV_ERROR */
#undef EV_ERROR
/* /*
* loop member variable declarations * loop member variable declarations
* *
* Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libev@schmorp.de> * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modifica- * Redistribution and use in source and binary forms, with or without modifica-
...@@ -43,6 +43,17 @@ VARx(ev_tstamp, now_floor) /* last time we refreshed rt_time */ ...@@ -43,6 +43,17 @@ VARx(ev_tstamp, now_floor) /* last time we refreshed rt_time */
VARx(ev_tstamp, mn_now) /* monotonic clock "now" */ VARx(ev_tstamp, mn_now) /* monotonic clock "now" */
VARx(ev_tstamp, rtmn_diff) /* difference realtime - monotonic time */ VARx(ev_tstamp, rtmn_diff) /* difference realtime - monotonic time */
/* for reverse feeding of events */
VARx(W *, rfeeds)
VARx(int, rfeedmax)
VARx(int, rfeedcnt)
VAR (pendings, ANPENDING *pendings [NUMPRI])
VAR (pendingmax, int pendingmax [NUMPRI])
VAR (pendingcnt, int pendingcnt [NUMPRI])
VARx(int, pendingpri) /* highest priority currently pending */
VARx(ev_prepare, pending_w) /* dummy pending watcher */
VARx(ev_tstamp, io_blocktime) VARx(ev_tstamp, io_blocktime)
VARx(ev_tstamp, timeout_blocktime) VARx(ev_tstamp, timeout_blocktime)
...@@ -58,16 +69,6 @@ VAR (backend_poll , void (*backend_poll)(EV_P_ ev_tstamp timeout)) ...@@ -58,16 +69,6 @@ VAR (backend_poll , void (*backend_poll)(EV_P_ ev_tstamp timeout))
VARx(ANFD *, anfds) VARx(ANFD *, anfds)
VARx(int, anfdmax) VARx(int, anfdmax)
VAR (pendings, ANPENDING *pendings [NUMPRI])
VAR (pendingmax, int pendingmax [NUMPRI])
VAR (pendingcnt, int pendingcnt [NUMPRI])
VARx(ev_prepare, pending_w) /* dummy pending watcher */
/* for reverse feeding of events */
VARx(W *, rfeeds)
VARx(int, rfeedmax)
VARx(int, rfeedcnt)
#if EV_USE_EVENTFD || EV_GENWRAP #if EV_USE_EVENTFD || EV_GENWRAP
VARx(int, evfd) VARx(int, evfd)
#endif #endif
...@@ -110,6 +111,7 @@ VARx(int, epoll_epermmax) ...@@ -110,6 +111,7 @@ VARx(int, epoll_epermmax)
#endif #endif
#if EV_USE_KQUEUE || EV_GENWRAP #if EV_USE_KQUEUE || EV_GENWRAP
VARx(pid_t, kqueue_fd_pid)
VARx(struct kevent *, kqueue_changes) VARx(struct kevent *, kqueue_changes)
VARx(int, kqueue_changemax) VARx(int, kqueue_changemax)
VARx(int, kqueue_changecnt) VARx(int, kqueue_changecnt)
...@@ -199,8 +201,8 @@ VARx(unsigned int, loop_count) /* total number of loop iterations/blocks */ ...@@ -199,8 +201,8 @@ VARx(unsigned int, loop_count) /* total number of loop iterations/blocks */
VARx(unsigned int, loop_depth) /* #ev_run enters - #ev_run leaves */ VARx(unsigned int, loop_depth) /* #ev_run enters - #ev_run leaves */
VARx(void *, userdata) VARx(void *, userdata)
VAR (release_cb, void (*release_cb)(EV_P)) VAR (release_cb, void (*release_cb)(EV_P) EV_THROW)
VAR (acquire_cb, void (*acquire_cb)(EV_P)) VAR (acquire_cb, void (*acquire_cb)(EV_P) EV_THROW)
VAR (invoke_cb , void (*invoke_cb) (EV_P)) VAR (invoke_cb , void (*invoke_cb) (EV_P))
#endif #endif
......
...@@ -48,6 +48,16 @@ ...@@ -48,6 +48,16 @@
/* for the crt to do something about it */ /* for the crt to do something about it */
volatile double SIGFPE_REQ = 0.0f; volatile double SIGFPE_REQ = 0.0f;
static SOCKET
ev_tcp_socket (void)
{
#if EV_USE_WSASOCKET
return WSASocket (AF_INET, SOCK_STREAM, 0, 0, 0, 0);
#else
return socket (AF_INET, SOCK_STREAM, 0);
#endif
}
/* oh, the humanity! */ /* oh, the humanity! */
static int static int
ev_pipe (int filedes [2]) ev_pipe (int filedes [2])
...@@ -59,7 +69,7 @@ ev_pipe (int filedes [2]) ...@@ -59,7 +69,7 @@ ev_pipe (int filedes [2])
SOCKET listener; SOCKET listener;
SOCKET sock [2] = { -1, -1 }; SOCKET sock [2] = { -1, -1 };
if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) if ((listener = ev_tcp_socket ()) == INVALID_SOCKET)
return -1; return -1;
addr.sin_family = AF_INET; addr.sin_family = AF_INET;
...@@ -75,7 +85,7 @@ ev_pipe (int filedes [2]) ...@@ -75,7 +85,7 @@ ev_pipe (int filedes [2])
if (listen (listener, 1)) if (listen (listener, 1))
goto fail; goto fail;
if ((sock [0] = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) if ((sock [0] = ev_tcp_socket ()) == INVALID_SOCKET)
goto fail; goto fail;
if (connect (sock [0], (struct sockaddr *)&addr, addr_size)) if (connect (sock [0], (struct sockaddr *)&addr, addr_size))
......
This diff is collapsed.
This diff is collapsed.
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
# compiler: $LTCC # compiler: $LTCC
# compiler flags: $LTCFLAGS # compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld) # linker: $LD (gnu? $with_gnu_ld)
# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu3 # $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2
# automake: $automake_version # automake: $automake_version
# autoconf: $autoconf_version # autoconf: $autoconf_version
# #
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
PROGRAM=ltmain.sh PROGRAM=ltmain.sh
PACKAGE=libtool PACKAGE=libtool
VERSION="2.2.6b Debian-2.2.6b-2ubuntu3" VERSION="2.2.6b Debian-2.2.6b-2"
TIMESTAMP="" TIMESTAMP=""
package_revision=1.3017 package_revision=1.3017
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment