about summary refs log tree commit homepage
path: root/queue_kqueue.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-04-21 21:45:58 +0000
committerEric Wong <normalperson@yhbt.net>2012-04-21 21:50:44 +0000
commitba63c8bc399f3d01a29171abdde56d4577bb4394 (patch)
treecc057b6aa02a2f79a2afdef71893b2250d19a859 /queue_kqueue.c
parent4c1f0946b7909543092fed20b986fe842d18e410 (diff)
downloadcmogstored-ba63c8bc399f3d01a29171abdde56d4577bb4394.tar.gz
EBADF is majorly bad news for threaded apps like this one and
indicative of a fatal bug, so be sure we enforce it so it never
happens.  We also never close file kqueue or epoll file
descriptors, so EBADF should really never happen.

ENOMEM from epoll_ctl() should be recoverable by falling back
to the active queue.
Diffstat (limited to 'queue_kqueue.c')
-rw-r--r--queue_kqueue.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/queue_kqueue.c b/queue_kqueue.c
index 5e3cc40..f7c7509 100644
--- a/queue_kqueue.c
+++ b/queue_kqueue.c
@@ -72,13 +72,8 @@ retry:
                 return NULL;
         }
 
-        switch (errno) {
-        case EINTR:
+        if (errno == EINTR)
                 goto retry;
-        case EBADF:
-        case EINVAL: /* kqueue_fd can be hit */
-                return NULL;
-        }
 
         die("kevent(wait) failed with (%d): %s\n", rc, strerror(errno));
         return NULL;
@@ -88,10 +83,6 @@ MOG_NOINLINE static void
 kevent_add_error(struct mog_queue *q, struct mog_fd *mfd)
 {
         switch (errno) {
-        case EBADF:
-                /* TODO: check for shutdown races */
-                syslog(LOG_ERR, "bad file descriptor for kevent(EV_ADD)");
-                return;
         case ENOMEM:
                 syslog(LOG_ERR, "kevent(EV_ADD) out-of-space");
                 if (mfd) {