From fa32b99837c0cc6aee42ac8d68588076a4f88efb Mon Sep 17 00:00:00 2001 From: 2 Date: Fri, 12 Oct 2001 23:08:32 +0000 Subject: Added environmental variable IBEX_OPEN_THRESHOLD which limits the maximum 2001-10-12 * ibex_block.c (ibex_use): Added environmental variable IBEX_OPEN_THRESHOLD which limits the maximum number of open ibex's that can be active at any time. The smallest this can be set to is the default of 5. svn path=/trunk/; revision=13642 --- libibex/ChangeLog | 7 +++++++ libibex/ibex_block.c | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/libibex/ChangeLog b/libibex/ChangeLog index 2f5a1e27af..b91a747552 100644 --- a/libibex/ChangeLog +++ b/libibex/ChangeLog @@ -1,3 +1,10 @@ +2001-10-12 + + * ibex_block.c (ibex_use): Added environmental variable + IBEX_OPEN_THRESHOLD which limits the maximum number of open ibex's + that can be active at any time. The smallest this can be set to + is the default of 5. + 2001-09-20 * ibex_block.c: Turn off the o(x) debug set, & include alloca.h & diff --git a/libibex/ibex_block.c b/libibex/ibex_block.c index 112ae140e2..7ce4e7934b 100644 --- a/libibex/ibex_block.c +++ b/libibex/ibex_block.c @@ -10,6 +10,7 @@ #include #include #include +#include #ifdef HAVE_ALLOCA_H #include @@ -24,6 +25,8 @@ static void ibex_reset(ibex *ib); static int close_backend(ibex *ib); static struct _list ibex_list = { (struct _listnode *)&ibex_list.tail, 0, (struct _listnode *)&ibex_list.head }; +static int ibex_open_init = 0; +static int ibex_open_threshold = IBEX_OPEN_THRESHOLD; #ifdef ENABLE_THREADS #include @@ -70,9 +73,22 @@ static void ibex_use(ibex *ib) IBEX_UNLOCK(ib); + /* check env variable override for open threshold */ + if (!ibex_open_init) { + char *limit; + + ibex_open_init = TRUE; + limit = getenv("IBEX_OPEN_THRESHOLD"); + if (limit) { + ibex_open_threshold = atoi(limit); + if (ibex_open_threshold < IBEX_OPEN_THRESHOLD) + ibex_open_threshold = IBEX_OPEN_THRESHOLD; + } + } + /* check for other ibex's we can close now to not over-use fd's. we can't do this first for locking issues */ - if (ibex_opened > IBEX_OPEN_THRESHOLD) { + if (ibex_opened > ibex_open_threshold) { wb = (ibex *)ibex_list.head; wn = wb->next; while (wn) { -- cgit v1.2.3