-) Let's not use _POSIX_SOURCE. It usually implies too much C99. _BSD_SOURCE would be the right thing to do here.
-) _BSD_SOURCE is getting deprecated by glibc, so we also have to define _DEFAULT_SOURCE under Linux.
-) accept4 and eventfd arn't as old as we may think; let's detect for it.
-) stdint.h interferes with all these definitions if included too early; let's move it down.
Allow binding a different completion queue to each registered method.
This will allow multiplexing for the C++ server between sync & async
methods more easily.
Let's include <features.h> to figure out if the system we're on is supporting secure_getenv, and adapt accordingly.
I suspect we might want to do the same with epoll, as it was added to glibc in 2.3.2, and eventfd has been added to glibc in 2.8.
This is a multipoller based on epoll rather than poll.
Note that this implementation is aimed at correctness rather than
performance, although it should immediately have better scalability to
large numbers of FDs, both due to epoll's O(1) sized API and due to not
needing to wake up polling threads to do interest set changes.
One notable difference here is that we directly attach a wakeup fd
rather than using the freelisting kick mechanism that the poll() based
implementations use, because modifying the epoll set to use a different
kick fd each time isn't free.