>From 32701d12fc6ddf8e3289ea920423c0e55210e3a5 Mon Sep 17 00:00:00 2001 From: Roman Rakus Date: Thu, 23 Aug 2012 19:35:52 +0200 Subject: [PATCH] Option to use fixed number of remembered job exit statuses Signed-off-by: Roman Rakus --- config.h.in | 3 +++ configure.in | 13 +++++++++++++ jobs.c | 8 ++++++++ 3 files changed, 24 insertions(+) diff --git a/config.h.in b/config.h.in index 6b1fc4a..b09b939 100644 --- a/config.h.in +++ b/config.h.in @@ -1125,6 +1125,9 @@ /* End additions for lib/intl */ +/* Define if you want to use fixed number of remembered job exit statuses */ +#undef USE_FIXEDJSMAX_NUMBER + #include "config-bot.h" #endif /* _CONFIG_H_ */ diff --git a/configure.in b/configure.in index d7e0998..dd5e0c9 100644 --- a/configure.in +++ b/configure.in @@ -1107,6 +1107,19 @@ case "$srcdir" in ;; esac +AC_MSG_CHECKING([whether to use fixed number of remembered job exit statuses]) +AC_ARG_ENABLE([fixedjsmax], + [AS_HELP_STRING([--enable-fixedjsmax=number], + [Enable fixed number of remembered job exit statuses])], + [ENABLE_FIXEDJSMAX="${enableval}"], [ENABLE_FIXEDJSMAX='no']) +AC_MSG_RESULT(${ENABLE_FIXEDJSMAX}) +if test "x${ENABLE_FIXEDJSMAX}" != xno; then + AS_IF([test "${ENABLE_FIXEDJSMAX}" -gt "0" 2>/dev/null], + AC_DEFINE_UNQUOTED(USE_FIXEDJSMAX_NUMBER, [${ENABLE_FIXEDJSMAX}]), + AC_MSG_ERROR([invalid value])) +fi + + BUILD_DIR=`pwd` case "$BUILD_DIR" in *\ *) BUILD_DIR=`echo "$BUILD_DIR" | sed 's: :\\\\ :g'` ;; diff --git a/jobs.c b/jobs.c index d63c5dd..7744b5e 100644 --- a/jobs.c +++ b/jobs.c @@ -3723,9 +3723,13 @@ initialize_job_control (force) get_tty_state (); if (js.c_childmax < 0) +#if defined (USE_FIXEDJSMAX_NUMBER) + js.c_childmax = USE_FIXEDJSMAX_NUMBER; +#else js.c_childmax = getmaxchild (); if (js.c_childmax < 0) js.c_childmax = DEFAULT_CHILD_MAX; +#endif return job_control; } @@ -4092,9 +4096,13 @@ mark_dead_jobs_as_notified (force) #endif if (js.c_childmax < 0) +#if defined (USE_FIXEDJSMAX_NUMBER) + js.c_childmax = USE_FIXEDJSMAX_NUMBER; +#else js.c_childmax = getmaxchild (); if (js.c_childmax < 0) js.c_childmax = DEFAULT_CHILD_MAX; +#endif /* Don't do anything if the number of dead processes is less than CHILD_MAX and we're not forcing a cleanup. */ -- 1.7.11.4