]> granicus.if.org Git - libevent/commitdiff
support disabling of event mechanisms via the environment; error out
authorNiels Provos <provos@gmail.com>
Sat, 1 Mar 2003 19:46:27 +0000 (19:46 +0000)
committerNiels Provos <provos@gmail.com>
Sat, 1 Mar 2003 19:46:27 +0000 (19:46 +0000)
if no event mechanism is available

svn:r38

event.c
poll.c
select.c

diff --git a/event.c b/event.c
index f657028b40c5770db51399c815039f5832a2d7ef..182847a5b0a1653af3ef8c5be16e24a3e7aa9dab 100644 (file)
--- a/event.c
+++ b/event.c
@@ -133,6 +133,9 @@ event_init(void)
                evbase = evsel->init();
        }
 
+       if (evbase == NULL)
+               errx(1, "%s: no event mechanism available", __func__);
+
 #if defined(USE_LOG) && defined(USE_DEBUG)
        log_to(stderr);
        log_debug_cmd(LOG_MISC, 80);
diff --git a/poll.c b/poll.c
index f84d355379b31fbcaa5810126bf5ffa54b514be4..8f30086b444e9237afaf7afbbb488c5c5465a20d 100644 (file)
--- a/poll.c
+++ b/poll.c
@@ -92,6 +92,10 @@ struct eventop pollops = {
 void *
 poll_init(void)
 {
+       /* Disable kqueue when this environment variable is set */
+       if (getenv("EVENT_NOPOLL"))
+               return (NULL);
+
        memset(&pop, 0, sizeof(pop));
 
        evsignal_init(&pop.evsigmask);
index bed156247ef2c9549e5cc2fc658f57e47f6f2bbe..86d0e357b8e665cc32eb8c2bd2d4b546550ca2ca 100644 (file)
--- a/select.c
+++ b/select.c
@@ -96,6 +96,10 @@ struct eventop selectops = {
 void *
 select_init(void)
 {
+       /* Disable kqueue when this environment variable is set */
+       if (getenv("EVENT_NOSELECT"))
+               return (NULL);
+
        memset(&sop, 0, sizeof(sop));
 
        evsignal_init(&sop.evsigmask);