support disabling of event mechanisms via the environment; error out

if no event mechanism is available


svn:r38
This commit is contained in:
Niels Provos 2003-03-01 19:46:27 +00:00
parent b3d1c6a854
commit b5b585c1f9
3 changed files with 11 additions and 0 deletions

View File

@ -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);

4
poll.c
View File

@ -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);

View File

@ -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);