summaryrefslogtreecommitdiffstats
path: root/configure
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2021-01-28 11:54:05 +0000
committerRoy Marples <roy@marples.name>2021-01-28 11:54:05 +0000
commit11baa2a1f51c8da51883ab341f6e00e4f73c6998 (patch)
tree4a069f765b1466d7e1e40003e73a716c12245429 /configure
parent3ffb1dd5ee2a4962dd1384e00566996f791fcc78 (diff)
downloaddhcpcd-11baa2a1f51c8da51883ab341f6e00e4f73c6998.tar.xz
BSD: Implement kqueue(2) for eloop (again)
kqueue allows for O(1) processing of active fd's an a more robust signal handling method without the need to use global variables to avoid calling functions during signal delivery. The problems with the prior implemenation have now been fixed.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure45
1 files changed, 45 insertions, 0 deletions
diff --git a/configure b/configure
index 7ac2abf6..59673c86 100755
--- a/configure
+++ b/configure
@@ -1222,6 +1222,43 @@ fi
echo "#define HAVE_REALLOCARRAY" >>$CONFIG_H
if [ -z "$POLL" ]; then
+ printf "Testing for kqueue1 ... "
+ cat <<EOF >_kqueue1.c
+#include <sys/event.h>
+#include <sys/fcntl.h>
+#include <sys/wait.h>
+int main(void) {
+ return kqueue1(O_CLOEXEC);
+}
+EOF
+ if $XCC _kqueue1.c -o _kqueue1 2>&3; then
+ POLL=kqueue1
+ echo "yes"
+ else
+ echo "no"
+ fi
+ rm -f _kqueue1.c _kqueue1
+fi
+
+if [ -z "$POLL" ]; then
+ printf "Testing for kqueue ... "
+ cat <<EOF >_kqueue.c
+#include <sys/event.h>
+#include <sys/wait.h>
+int main(void) {
+ return kqueue();
+}
+EOF
+ if $XCC _kqueue.c -o _kqueue 2>&3; then
+ POLL=kqueue
+ echo "yes"
+ else
+ echo "no"
+ fi
+ rm -f _kqueue.c _kqueue
+fi
+
+if [ -z "$POLL" ]; then
printf "Testing for ppoll ... "
cat <<EOF >_ppoll.c
#include <poll.h>
@@ -1276,6 +1313,14 @@ EOF
rm -f _pselect.c _pselect
fi
case "$POLL" in
+kqueue1)
+ echo "#define HAVE_KQUEUE" >>$CONFIG_H
+ echo "#define HAVE_KQUEUE1" >>$CONFIG_H
+ POLL=kqueue
+ ;;
+kqueue)
+ echo "#define HAVE_KQUEUE" >>$CONFIG_H
+ ;;
ppoll)
echo "#define HAVE_PPOLL" >>$CONFIG_H
;;