libevent integration

master
Marc Alexander Lehmann 16 years ago
parent a1693a8f48
commit 65c9e3cac2

11
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);
}
}
}

@ -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

@ -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)

@ -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 "$@"

Loading…
Cancel
Save