From 4e62f1267caf106a83789131419fc7d2853bcd4f Mon Sep 17 00:00:00 2001 From: root Date: Wed, 28 Nov 2007 11:41:18 +0000 Subject: [PATCH] libevent integration --- ev.c | 11 +++++------ ev_vars.h | 2 +- ev_wrap.h | 2 +- import_libevent | 4 +++- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ev.c b/ev.c index 0d5e4b9..ab89221 100644 --- a/ev.c +++ b/ev.c @@ -1718,7 +1718,7 @@ ev_child_stop (EV_P_ ev_child *w) void noinline stat_timer_cb (EV_P_ ev_timer *w_, int revents); #if EV_USE_INOTIFY -# define EV_INOTIFY_BUFSIZE ((PATH_MAX + sizeof (struct inotify_event)) + 2048) +# define EV_INOTIFY_BUFSIZE 8192 static void noinline infy_add (EV_P_ ev_stat *w) @@ -1730,9 +1730,9 @@ infy_add (EV_P_ ev_stat *w) ev_timer_start (EV_A_ &w->timer); /* this is not race-free, so we still need to recheck periodically */ /* monitor some parent directory for speedup hints */ - if (errno == ENOENT || errno == EACCES) + if ((errno == ENOENT || errno == EACCES) && strlen (w->path) < 4096) { - char path [PATH_MAX]; + char path [4096]; strcpy (path, w->path); do @@ -1746,7 +1746,7 @@ infy_add (EV_P_ ev_stat *w) break; /* whoops, no '/', complain to your admin */ *pend = 0; - w->wd = inotify_add_watch (fs_fd, path, IN_DELETE_SELF | IN_CREATE | IN_MOVED_TO | IN_MASK_ADD); + w->wd = inotify_add_watch (fs_fd, path, mask); } while (w->wd < 0 && (errno == ENOENT || errno == EACCES)); } @@ -1761,7 +1761,6 @@ infy_add (EV_P_ ev_stat *w) static void noinline infy_del (EV_P_ ev_stat *w) { - WL w_; int slot; int wd = w->wd; @@ -1800,7 +1799,7 @@ infy_wd (EV_P_ int slot, int wd, struct inotify_event *ev) infy_add (EV_A_ w); /* re-add, no matter what */ } - stat_timer_cb (EV_P_ &w->timer, 0); + stat_timer_cb (EV_A_ &w->timer, 0); } } } diff --git a/ev_vars.h b/ev_vars.h index 3750492..c93d23a 100644 --- a/ev_vars.h +++ b/ev_vars.h @@ -88,7 +88,7 @@ VARx(int, forkcnt) #if EV_USE_INOTIFY || EV_GENWRAP VARx(int, fs_fd) -VARx(ev_io, fs_w); +VARx(ev_io, fs_w) VAR (fs_hash, ANFS fs_hash [EV_INOTIFY_HASHSIZE]) #endif diff --git a/ev_wrap.h b/ev_wrap.h index f3942f9..67e7cfd 100644 --- a/ev_wrap.h +++ b/ev_wrap.h @@ -55,5 +55,5 @@ #define forkmax ((loop)->forkmax) #define forkcnt ((loop)->forkcnt) #define fs_fd ((loop)->fs_fd) -#define fs_w ((loop)->fs_w); +#define fs_w ((loop)->fs_w) #define fs_hash ((loop)->fs_hash) diff --git a/import_libevent b/import_libevent index 78de8d8..f8db3c1 100755 --- a/import_libevent +++ b/import_libevent @@ -82,7 +82,7 @@ perl -ne ' s/\bevsignal.h\b//g; s/-Wall//; s/^(man_MANS\s*=)/$1 ev.3 /; - s/^(EXTRA_DIST\s*=)/$1 ev.h ev_vars.h ev_wrap.h event_compat.h ev_epoll.c ev_select.c ev_poll.c ev_kqueue.c ev_port.c ev_win32.c ev.3 ev.pod ev.html /; + s/^(EXTRA_DIST\s*=)/$1 libev.m4 ev.h ev_vars.h ev_wrap.h event_compat.h ev_epoll.c ev_select.c ev_poll.c ev_kqueue.c ev_port.c ev_win32.c ev.3 ev.pod ev.html /; s/^(include_HEADERS\s*=)/$1 ev.h event_compat.h /; s/^(CORE_SRC\s*=)/$1 ev.c /; s/^(SYS_LIBS\s*=)/$1 -lm /; @@ -100,12 +100,14 @@ perl -ne ' s/AC_LIBOBJ\(evport\)/: ;/g; s/AC_LIBOBJ\(signal\)/: ;/g; s/AC_LIBOBJ\(rtsig\)/: ;/g; + print "m4_include([libev.m4])\n" if /^AC_OUTPUT/; print; ' <$LE/configure.in >configure.in aclocal-1.7 automake-1.7 --add-missing autoconf +autoheader libtoolize CC="ccache gcc" ./configure --prefix=/opt/libev --disable-shared "$@" -- 2.43.0