From: Stefan Metzmacher Date: Mon, 5 Jan 2009 07:50:07 +0000 (+0100) Subject: feature X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=e6c324aaec89b6c561e19018b0ccbd5d9c0eea73 feature --- diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index 99cd074e655a..2cebe51939ae 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -409,6 +409,10 @@ struct tevent_context *tevent_context_init_ops(TALLOC_CTX *mem_ctx, ev->ops = ops; ev->additional_data = additional_data; + /* FD and TIMER events are always supported */ + ev->features |= TEVENT_FEATURE_FD_SUPPORT; + ev->features |= TEVENT_FEATURE_TIMER_SUPPORT; + ret = ev->ops->context_init(ev); if (ret != 0) { talloc_free(ev); diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h index 7de04d03896c..e004e42a37bb 100644 --- a/lib/tevent/tevent.h +++ b/lib/tevent/tevent.h @@ -29,6 +29,7 @@ #define __TEVENT_H__ #include +#include #include #include #include @@ -158,6 +159,13 @@ const char **tevent_backend_list(TALLOC_CTX *mem_ctx); */ void tevent_set_default_backend(const char *backend); +#define TEVENT_FEATURE_FD_SUPPORT 0x00000001 +#define TEVENT_FEATURE_TIMER_SUPPORT 0x00000002 +#define TEVENT_FEATURE_SIGNAL_SUPPORT 0x00000004 +#define TEVENT_FEATURE_AIO_SUPPORT 0x00000008 + +bool tevent_have_features(struct tevent_context *ev, uint32_t features); + #ifdef DOXYGEN /** * @brief Add a file descriptor based event. diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index 4147c67af2a0..0e47a018fd50 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -758,6 +758,7 @@ static int epoll_event_context_init(struct tevent_context *ev) return ret; } + ev->features |= TEVENT_FEATURE_SIGNAL_SUPPORT; ev->additional_data = epoll_ev; return 0; } diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h index 6f0ecfdbe3f2..8d72ee5869f8 100644 --- a/lib/tevent/tevent_internal.h +++ b/lib/tevent/tevent_internal.h @@ -246,6 +246,8 @@ struct tevent_context { /* the specific events implementation */ const struct tevent_ops *ops; + uint32_t features; + /* * The following three pointers are queried on every loop_once * in the order in which they appear here. Not measured, but diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c index 55dd0b66f66c..9a1e36dd6176 100644 --- a/lib/tevent/tevent_select.c +++ b/lib/tevent/tevent_select.c @@ -54,6 +54,7 @@ static int select_event_context_init(struct tevent_context *ev) if (!select_ev) return -1; select_ev->ev = ev; + ev->features |= TEVENT_FEATURE_SIGNAL_SUPPORT; ev->additional_data = select_ev; return 0; }