aboutsummaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-10-18 21:24:13 +0200
committerlaforge <laforge@osmocom.org>2020-10-23 15:09:05 +0000
commitb904e428aa03c806a39b11bcda296bf63fec494e (patch)
tree901d23e7259d473dd70d5082e9ffedd4cc881e27 /configure.ac
parent6760845da6587785f49af564cfad336fb9fe1586 (diff)
select: Migrate over to poll()
select is an ancient interface with weird restrictions, such as the fact that it cannot be used for file descriptor values > 1024. This may have been sufficient 40 years ago, but certainly is not in 2020. I wanted to migrate to epoll(), but unfortunately it doesn't work well with the fact that existing programs simply set osmo_fd.flags without making any API calls at the time they change those flags. So let's do the migration to poll() as a first step, and then consider epoll() as a second step further down the road, after introducing new APIs and porting applications over. The poll() code introduced in this patch is not extremely efficient, as it needs to do extensive linked list iterations after poll() returns in order to find the osmo_fd from the fd. Optimization is possible, but let's postpone that to a follow-up patch. At compile time, a new --enable-force-io-select argument can be given to configure, forcing the use of the old select() backend instead of the new poll() based backend. Change-Id: I9e80da68a144b36926066610d0d3df06abe09bca
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac12
1 files changed, 11 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index e8671974..7de495bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -62,7 +62,7 @@ AC_SUBST(LTLDFLAGS_OSMOCTRL)
dnl checks for header files
AC_HEADER_STDC
-AC_CHECK_HEADERS(execinfo.h sys/select.h sys/socket.h sys/signalfd.h sys/timerfd.h syslog.h ctype.h netinet/tcp.h netinet/in.h)
+AC_CHECK_HEADERS(execinfo.h poll.h sys/select.h sys/socket.h sys/signalfd.h sys/timerfd.h syslog.h ctype.h netinet/tcp.h netinet/in.h)
# for src/conv.c
AC_FUNC_ALLOCA
AC_SEARCH_LIBS([dlopen], [dl dld], [LIBRARY_DLOPEN="$LIBS";LIBS=""])
@@ -252,6 +252,16 @@ then
AC_DEFINE([OSMO_FD_CHECK],[1],[Instrument the osmo_fd_register])
fi
+AC_ARG_ENABLE([force_io_select],
+ [AS_HELP_STRING(
+ [--enable-force-io-select],
+ [Build with old select I/O instead of poll]
+ )],
+ [force_io_select=$enableval], [force_io_select="no"])
+AS_IF([test "x$force_io_select" = "xyes"], [
+ AC_DEFINE([FORCE_IO_SELECT], [1], [Force the use of select() instaed of poll()])
+])
+
AC_ARG_ENABLE(msgfile,
[AS_HELP_STRING(
[--disable-msgfile],