From d5f92571083c82347f58a415db828b064e377522 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 22 Feb 2013 14:26:16 +0100 Subject: [PATCH] tevent: define TEVENT_NUM_SIGNALS based on configure checks Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison --- lib/tevent/libtevent.m4 | 29 +++++++++++++++++++++++++++++ lib/tevent/tevent_signal.c | 2 -- lib/tevent/wscript | 17 +++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/lib/tevent/libtevent.m4 b/lib/tevent/libtevent.m4 index 5c5969b0df5..4d4fd2bd77a 100644 --- a/lib/tevent/libtevent.m4 +++ b/lib/tevent/libtevent.m4 @@ -39,6 +39,35 @@ if test x"$ac_cv_header_sys_epoll_h" = x"yes" -a x"$ac_cv_func_epoll_create" = x AC_DEFINE(HAVE_EPOLL, 1, [Whether epoll available]) fi +tevent_num_signals_includes="$ac_includes_default +#include +" +tevent_num_signals=64 +AC_CHECK_VALUEOF(NSIG, [$tevent_num_signals_includes]) +v=$ac_cv_valueof_NSIG +test -n "$v" && test "$v" -gt "$tevent_num_signals" && { + tevent_num_signals=$v +} +AC_CHECK_VALUEOF(_NSIG, [$tevent_num_signals_includes]) +v=$ac_cv_valueof__NSIG +test -n "$v" && test "$v" -gt "$tevent_num_signals" && { + tevent_num_signals=$v +} +AC_CHECK_VALUEOF(SIGRTMAX, [$tevent_num_signals_includes]) +v=$ac_cv_valueof_SIGRTMAX +test -n "$v" && test "$v" -gt "$tevent_num_signals" && { + tevent_num_signals=$v +} +AC_CHECK_VALUEOF(SIGRTMIN, [$tevent_num_signals_includes]) +v=$ac_cv_valueof_SIGRTMIN +test -n "$v" && { + v=`expr $v + $v` +} +test -n "$v" && test "$v" -gt "$tevent_num_signals" && { + tevent_num_signals=$v +} +AC_DEFINE_UNQUOTED(TEVENT_NUM_SIGNALS, $tevent_num_signals, [Max signal number value]) + if test x"$VERSIONSCRIPT" != "x"; then EXPORTSFILE=tevent.exports AC_SUBST(EXPORTSFILE) diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index 9582f6e7acd..b5a56ef03aa 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -30,8 +30,6 @@ #include "tevent_internal.h" #include "tevent_util.h" -#define TEVENT_NUM_SIGNALS 64 - /* maximum number of SA_SIGINFO signals to hold in the queue. NB. This *MUST* be a power of 2, in order for the ring buffer wrap to work correctly. Thanks to Petr Vandrovec diff --git a/lib/tevent/wscript b/lib/tevent/wscript index 684286d8c4e..c62c3de3173 100755 --- a/lib/tevent/wscript +++ b/lib/tevent/wscript @@ -44,6 +44,23 @@ def configure(conf): if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'): conf.DEFINE('HAVE_EPOLL', 1) + tevent_num_signals = 64 + v = conf.CHECK_VALUEOF('NSIG', headers='signal.h') + if v is not None: + tevent_num_signals = max(tevent_num_signals, v) + v = conf.CHECK_VALUEOF('_NSIG', headers='signal.h') + if v is not None: + tevent_num_signals = max(tevent_num_signals, v) + v = conf.CHECK_VALUEOF('SIGRTMAX', headers='signal.h') + if v is not None: + tevent_num_signals = max(tevent_num_signals, v) + v = conf.CHECK_VALUEOF('SIGRTMIN', headers='signal.h') + if v is not None: + tevent_num_signals = max(tevent_num_signals, v*2) + + if not conf.CONFIG_SET('USING_SYSTEM_TEVENT'): + conf.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals) + conf.env.disable_python = getattr(Options.options, 'disable_python', False) if not conf.env.disable_python: