From c3f9388b2399a5db44ee464d5c20276763aa75f1 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Mon, 31 Oct 2005 21:25:21 +0000 Subject: provide an alternate getloadavg implementation and a fallback for systems that don't have it at all (issue #5549 with minor mods) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6903 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- asterisk.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'asterisk.c') diff --git a/asterisk.c b/asterisk.c index 026654e86..43cc189fe 100755 --- a/asterisk.c +++ b/asterisk.c @@ -1874,7 +1874,12 @@ static void ast_readconfig(void) { option_maxcalls = 0; } } else if (!strcasecmp(v->name, "maxload")) { - if ((sscanf(v->value, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) { + double test[1]; + + if (getloadavg(test, 1) == -1) { + ast_log(LOG_ERROR, "Cannot obtain load average on this system. 'maxload' option disabled.\n"); + option_maxload = 0.0; + } else if ((sscanf(v->value, "%lf", &option_maxload) != 1) || (option_maxload < 0.0)) { option_maxload = 0.0; } } -- cgit v1.2.3