feature
authorStefan Metzmacher <metze@samba.org>
Mon, 5 Jan 2009 07:50:07 +0000 (08:50 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 07:51:49 +0000 (09:51 +0200)
lib/tevent/tevent.c
lib/tevent/tevent.h
lib/tevent/tevent_epoll.c
lib/tevent/tevent_internal.h

index 6f5497875d8d1a55cf996464a1b16c88508b8ede..846757b824160ce4827cb0cb4b36fff36a9a9607 100644 (file)
@@ -484,6 +484,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);
index 52e081b4ff4ec53dde231c845d1b546019bd7ec7..bbd798da13b82ba9c51e2339915fd71cab0b106a 100644 (file)
@@ -29,6 +29,7 @@
 #define __TEVENT_H__
 
 #include <stdint.h>
+#include <stdbool.h>
 #include <talloc.h>
 #include <sys/time.h>
 #include <stdbool.h>
@@ -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.
index 5f7ef5d83d173ed31ecf1efa4a18d74d8eda2461..e1363d44438d093240f66f44a336a492b0a71147 100644 (file)
@@ -757,6 +757,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;
 }
index e90dd5ef82682dfb2c351aca4589f5f923bc178b..644d4370e7a6041931c1cb8dd36ea20b84f1acd2 100644 (file)
@@ -266,6 +266,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