fix compilation errors on rhel5

git-svn-id: svn://svn.code.sf.net/p/libkqueue/code/trunk@336 fb4e3144-bc1c-4b72-a658-5bcd248dd7f7
This commit is contained in:
mheily 2010-09-15 02:37:42 +00:00
parent 32ba7bbd00
commit 45f04b4d6c
3 changed files with 18 additions and 4 deletions

View File

@ -29,6 +29,9 @@ pre_configure_hook() {
libdepends=" -L$libdir"
if [ $target = "linux" ] ; then
check_symbol sys/epoll.h EPOLLRDHUP
# Actually a GCC 4.X dependency
cflags="$cflags -fvisibility=hidden"
@ -51,7 +54,7 @@ post_configure_hook() {
evfilt_signal="src/posix/signal.c"
evfilt_proc="src/$target/proc.c"
evfilt_socket="src/$target/socket.c"
evfilt_timer="src/$target/timer.c"
evfilt_timer="src/posix/timer.c"
evfilt_user="src/posix/user.c"
evfilt_vnode="src/$target/vnode.c"
eventfd="src/posix/eventfd.c"
@ -61,8 +64,8 @@ post_configure_hook() {
#if [ "$have_sys_signalfd_h" = "yes" ] ; then
# evfilt_signal="src/linux/signal.c"
#fi
if [ "$have_sys_timerfd_h" != "yes" ] ; then
evfilt_timer="src/posix/timer.c"
if [ "$have_sys_timerfd_h" = "yes" ] ; then
evfilt_timer="src/linux/timer.c"
fi
if [ "$have_sys_eventfd_h" = "yes" ] ; then
eventfd="src/linux/eventfd.c"

View File

@ -49,7 +49,9 @@ epoll_event_dump(struct epoll_event *evt)
snprintf(&buf[0], 128, " { data = %p, events = ", evt->data.ptr);
EPEVT_DUMP(EPOLLIN);
EPEVT_DUMP(EPOLLOUT);
#if defined(HAVE_EPOLLRDHUP)
EPEVT_DUMP(EPOLLRDHUP);
#endif
EPEVT_DUMP(EPOLLONESHOT);
EPEVT_DUMP(EPOLLET);
strcat(&buf[0], "}\n");
@ -122,8 +124,13 @@ evfilt_socket_copyout(struct filter *filt,
kn = knote_lookup(filt, ev->data.fd);
if (kn != NULL) {
memcpy(dst, &kn->kev, sizeof(*dst));
#if defined(HAVE_EPOLLRDHUP)
if (ev->events & EPOLLRDHUP || ev->events & EPOLLHUP)
dst->flags |= EV_EOF;
#else
if (ev->events & EPOLLHUP)
dst->flags |= EV_EOF;
#endif
if (ev->events & EPOLLERR)
dst->fflags = 1; /* FIXME: Return the actual socket error */
@ -171,7 +178,11 @@ evfilt_socket_knote_create(struct filter *filt, struct knote *kn)
/* Convert the kevent into an epoll_event */
if (kn->kev.filter == EVFILT_READ)
#if defined(HAVE_EPOLLRDHUP)
kn->data.events = EPOLLIN | EPOLLRDHUP;
#else
kn->data.events = EPOLLIN;
#endif
else
kn->data.events = EPOLLOUT;
if (kn->kev.flags & EV_ONESHOT || kn->kev.flags & EV_DISPATCH)

View File

@ -43,7 +43,7 @@ static int
update_timeres(struct filter *filt, struct knote *kn)
{
struct itimerspec tval;
u_int cur = filt->kf_timeres;
unsigned int cur = filt->kf_timeres;
dbg_printf("new timer interval = %d", cur);
filt->kf_timeres = cur;