mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -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; | ||||
| 			} | ||||
| 		} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user