Issue 28153: [Patch] selectmodule: Make kqueue()'s event filters optional (original) (raw)
Just like the BSDs and Mac OS X, CloudABI (https://mail.python.org/pipermail/python-dev/2016-July/145708.html) provides support for kqueue(). Its implementation, however, is far more limited. It can only be used for polling on descriptors (EVFILT_READ/EVFILT_WRITE) and waiting on timers (EVFILT_TIMER).
The existing selectmodule already allows some filters to be present optionally (e.g., EVFILT_NETDEV). The attached patch extends this work by only defining the filter and corresponding filter flags when available.
I've also added guards around EV_SYSFLAGS and EV_FLAG1. EV_SYSFLAGS is a flag that's typically only used by the kernel to trim off flags that are only used internally. EV_FLAG1 is an example of such a flag, which seems to be used by FreeBSD to mark incoming AIO events as validated. I would even go as far as to remove these two flags from the module entirely, but let's not take the risk.