mirror of
https://github.com/darlinghq/darling-libkqueue.git
synced 2024-11-23 03:39:51 +00:00
Use ifdef instead of check_decl() where possible.
git-svn-id: svn://svn.code.sf.net/p/libkqueue/code/trunk@612 fb4e3144-bc1c-4b72-a658-5bcd248dd7f7
This commit is contained in:
parent
a21da812d9
commit
24baeafda7
12
configure.rb
12
configure.rb
@ -120,7 +120,7 @@ kq = Library.new(
|
||||
|
||||
if Platform.is_linux?
|
||||
project.check_decl 'EPOLLRDHUP', :include => 'sys/epoll.h'
|
||||
project.check_decl 'ppoll', :cflags => '#define _GNU_SOURCE', :include => '<poll.h>'
|
||||
project.check_decl 'ppoll', :cflags => '#define _GNU_SOURCE', :include => 'poll.h'
|
||||
|
||||
|
||||
project.check_header('sys/epoll.h') or throw 'epoll is required'
|
||||
@ -180,16 +180,6 @@ else
|
||||
)
|
||||
end
|
||||
|
||||
if project.check_header 'sys/event.h'
|
||||
# TODO: test for non-standard kqueue things like EV_RECEIPT
|
||||
# This will allow running the testsuite against the native
|
||||
else
|
||||
# Assume libkqueue
|
||||
project.define 'HAVE_EVFILT_USER'
|
||||
project.define 'HAVE_EV_RECEIPT'
|
||||
project.define 'HAVE_EV_DISPATCH'
|
||||
end
|
||||
|
||||
mc = Makeconf.new()
|
||||
mc.configure(project)
|
||||
|
||||
|
@ -52,7 +52,6 @@
|
||||
#else
|
||||
# include "../include/sys/event.h"
|
||||
# include "../src/windows/platform.h"
|
||||
# define HAVE_EVFILT_USER 1
|
||||
#endif
|
||||
|
||||
struct test_context;
|
||||
@ -87,7 +86,7 @@ void test_evfilt_vnode(struct test_context *);
|
||||
void test_evfilt_timer(struct test_context *);
|
||||
void test_evfilt_timer_concurrent(struct test_context *);
|
||||
void test_evfilt_proc(struct test_context *);
|
||||
#if HAVE_EVFILT_USER
|
||||
#ifdef EVFILT_USER
|
||||
void test_evfilt_user(struct test_context *);
|
||||
#endif
|
||||
|
||||
|
@ -125,10 +125,10 @@ kevent_flags_dump(struct kevent *kev)
|
||||
KEVFL_DUMP(EV_CLEAR);
|
||||
KEVFL_DUMP(EV_EOF);
|
||||
KEVFL_DUMP(EV_ERROR);
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
KEVFL_DUMP(EV_DISPATCH);
|
||||
#endif
|
||||
#if HAVE_EV_RECEIPT
|
||||
#ifdef EV_RECEIPT
|
||||
KEVFL_DUMP(EV_RECEIPT);
|
||||
#endif
|
||||
buf[strlen(buf) - 1] = ')';
|
||||
|
@ -117,7 +117,7 @@ test_ev_receipt(void *unused)
|
||||
|
||||
if ((kq = kqueue()) < 0)
|
||||
die("kqueue()");
|
||||
#if HAVE_EV_RECEIPT
|
||||
#ifdef EV_RECEIPT
|
||||
|
||||
EV_SET(&kev, SIGUSR2, EVFILT_SIGNAL, EV_ADD | EV_RECEIPT, 0, 0, NULL);
|
||||
if (kevent(kq, &kev, 1, &kev, 1, NULL) < 0)
|
||||
@ -244,7 +244,7 @@ main(int argc, char **argv)
|
||||
#ifndef _WIN32
|
||||
{ "vnode", 1, 0, test_evfilt_vnode },
|
||||
#endif
|
||||
#if HAVE_EVFILT_USER
|
||||
#ifdef EVFILT_USER
|
||||
{ "user", 1, 0, test_evfilt_user },
|
||||
#endif
|
||||
{ NULL, 0, 0, NULL },
|
||||
|
@ -289,7 +289,7 @@ test_kevent_socket_listen_backlog(struct test_context *ctx)
|
||||
test_no_kevents(ctx->kqfd);
|
||||
}
|
||||
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
void
|
||||
test_kevent_socket_dispatch(struct test_context *ctx)
|
||||
{
|
||||
@ -321,7 +321,7 @@ test_kevent_socket_dispatch(struct test_context *ctx)
|
||||
|
||||
kevent_socket_drain(ctx);
|
||||
}
|
||||
#endif /* HAVE_EV_DISPATCH */
|
||||
#endif /* EV_DISPATCH */
|
||||
|
||||
#if BROKEN_ON_LINUX
|
||||
void
|
||||
@ -431,7 +431,7 @@ test_evfilt_read(struct test_context *ctx)
|
||||
test(kevent_socket_disable_and_enable, ctx);
|
||||
test(kevent_socket_oneshot, ctx);
|
||||
test(kevent_socket_clear, ctx);
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
test(kevent_socket_dispatch, ctx);
|
||||
#endif
|
||||
test(kevent_socket_listen_backlog, ctx);
|
||||
|
@ -134,7 +134,7 @@ test_kevent_signal_modify(struct test_context *ctx)
|
||||
test_kevent_signal_del(ctx);
|
||||
}
|
||||
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
void
|
||||
test_kevent_signal_dispatch(struct test_context *ctx)
|
||||
{
|
||||
@ -174,7 +174,7 @@ test_kevent_signal_dispatch(struct test_context *ctx)
|
||||
die("kill");
|
||||
test_no_kevents(ctx->kqfd);
|
||||
}
|
||||
#endif /* HAVE_EV_DISPATCH */
|
||||
#endif /* EV_DISPATCH */
|
||||
|
||||
void
|
||||
test_evfilt_signal(struct test_context *ctx)
|
||||
@ -188,7 +188,7 @@ test_evfilt_signal(struct test_context *ctx)
|
||||
test(kevent_signal_enable, ctx);
|
||||
test(kevent_signal_oneshot, ctx);
|
||||
test(kevent_signal_modify, ctx);
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
test(kevent_signal_dispatch, ctx);
|
||||
#endif
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ test_kevent_timer_disable_and_enable(struct test_context *ctx)
|
||||
kevent_cmp(&kev, &ret);
|
||||
}
|
||||
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
void
|
||||
test_kevent_timer_dispatch(struct test_context *ctx)
|
||||
{
|
||||
@ -153,7 +153,7 @@ test_kevent_timer_dispatch(struct test_context *ctx)
|
||||
sleep(1);
|
||||
test_no_kevents(ctx->kqfd);
|
||||
}
|
||||
#endif /* HAVE_EV_DISPATCH */
|
||||
#endif /* EV_DISPATCH */
|
||||
|
||||
void
|
||||
test_evfilt_timer(struct test_context *ctx)
|
||||
@ -164,7 +164,7 @@ test_evfilt_timer(struct test_context *ctx)
|
||||
test(kevent_timer_oneshot, ctx);
|
||||
test(kevent_timer_periodic, ctx);
|
||||
test(kevent_timer_disable_and_enable, ctx);
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
test(kevent_timer_dispatch, ctx);
|
||||
#endif
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ test_kevent_user_oneshot(struct test_context *ctx)
|
||||
test_no_kevents(ctx->kqfd);
|
||||
}
|
||||
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
void
|
||||
test_kevent_user_dispatch(struct test_context *ctx)
|
||||
{
|
||||
@ -153,7 +153,7 @@ test_kevent_user_dispatch(struct test_context *ctx)
|
||||
kevent_add(ctx->kqfd, &kev, 1, EVFILT_USER, EV_DELETE, 0, 0, NULL);
|
||||
test_no_kevents(ctx->kqfd);
|
||||
}
|
||||
#endif /* HAVE_EV_DISPATCH */
|
||||
#endif /* EV_DISPATCH */
|
||||
|
||||
void
|
||||
test_evfilt_user(struct test_context *ctx)
|
||||
@ -163,7 +163,7 @@ test_evfilt_user(struct test_context *ctx)
|
||||
test(kevent_user_get_hires, ctx);
|
||||
test(kevent_user_disable_and_enable, ctx);
|
||||
test(kevent_user_oneshot, ctx);
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
test(kevent_user_dispatch, ctx);
|
||||
#endif
|
||||
/* TODO: try different fflags operations */
|
||||
|
@ -196,7 +196,7 @@ test_kevent_vnode_disable_and_enable(struct test_context *ctx)
|
||||
test_id, (unsigned int)kev.ident, kev.filter, kev.flags);
|
||||
}
|
||||
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
void
|
||||
test_kevent_vnode_dispatch(struct test_context *ctx)
|
||||
{
|
||||
@ -235,7 +235,7 @@ test_kevent_vnode_dispatch(struct test_context *ctx)
|
||||
/* Delete the watch */
|
||||
kevent_add(ctx->kqfd, &kev, ctx->vnode_fd, EVFILT_VNODE, EV_DELETE, NOTE_ATTRIB, 0, NULL);
|
||||
}
|
||||
#endif /* HAVE_EV_DISPATCH */
|
||||
#endif /* EV_DISPATCH */
|
||||
|
||||
void
|
||||
test_evfilt_vnode(struct test_context *ctx)
|
||||
@ -259,7 +259,7 @@ test_evfilt_vnode(struct test_context *ctx)
|
||||
test(kevent_vnode_add, ctx);
|
||||
test(kevent_vnode_del, ctx);
|
||||
test(kevent_vnode_disable_and_enable, ctx);
|
||||
#if HAVE_EV_DISPATCH
|
||||
#ifdef EV_DISPATCH
|
||||
test(kevent_vnode_dispatch, ctx);
|
||||
#endif
|
||||
test(kevent_vnode_note_write, ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user