summaryrefslogtreecommitdiff
path: root/asterisk.c
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2005-10-31 21:25:21 +0000
committerKevin P. Fleming <kpfleming@digium.com>2005-10-31 21:25:21 +0000
commitc3f9388b2399a5db44ee464d5c20276763aa75f1 (patch)
tree0f0badcde0ec678b733ee9716f7b714dc959a31a /asterisk.c
parentf9c8bb8087782dd5afc82121f5539fc65d017cc8 (diff)
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
Diffstat (limited to 'asterisk.c')
-rwxr-xr-xasterisk.c7
1 files changed, 6 insertions, 1 deletions
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;
}
}