mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Solaris does not have a sysinfo like we know of on Linux.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77876 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -80,7 +80,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
@@ -166,7 +166,7 @@ int option_debug; /*!< Debug level */
|
|||||||
double option_maxload; /*!< Max load avg on system */
|
double option_maxload; /*!< Max load avg on system */
|
||||||
int option_maxcalls; /*!< Max number of active calls */
|
int option_maxcalls; /*!< Max number of active calls */
|
||||||
int option_maxfiles; /*!< Max number of open file handles (files, sockets) */
|
int option_maxfiles; /*!< Max number of open file handles (files, sockets) */
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
long option_minmemfree; /*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
|
long option_minmemfree; /*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ static int handle_show_settings(int fd, int argc, char *argv[])
|
|||||||
ast_cli(fd, " Verbosity: %d\n", option_verbose);
|
ast_cli(fd, " Verbosity: %d\n", option_verbose);
|
||||||
ast_cli(fd, " Debug level: %d\n", option_debug);
|
ast_cli(fd, " Debug level: %d\n", option_debug);
|
||||||
ast_cli(fd, " Max load avg: %lf\n", option_maxload);
|
ast_cli(fd, " Max load avg: %lf\n", option_maxload);
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
ast_cli(fd, " Min Free Memory: %ld MB\n", option_minmemfree);
|
ast_cli(fd, " Min Free Memory: %ld MB\n", option_minmemfree);
|
||||||
#endif
|
#endif
|
||||||
if (ast_localtime(&ast_startuptime, &tm, NULL)) {
|
if (ast_localtime(&ast_startuptime, &tm, NULL)) {
|
||||||
@@ -416,7 +416,7 @@ static int handle_show_threads(int fd, int argc, char *argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
static const char show_sysinfo_help[] =
|
static const char show_sysinfo_help[] =
|
||||||
"Usage: core show sysinfo\n"
|
"Usage: core show sysinfo\n"
|
||||||
" List current system information.\n";
|
" List current system information.\n";
|
||||||
@@ -1647,7 +1647,7 @@ static struct ast_cli_entry cli_asterisk[] = {
|
|||||||
handle_show_threads, "Show running threads",
|
handle_show_threads, "Show running threads",
|
||||||
show_threads_help },
|
show_threads_help },
|
||||||
|
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
{ { "core", "show", "sysinfo", NULL },
|
{ { "core", "show", "sysinfo", NULL },
|
||||||
handle_show_sysinfo, "Show System Information",
|
handle_show_sysinfo, "Show System Information",
|
||||||
show_sysinfo_help },
|
show_sysinfo_help },
|
||||||
@@ -2452,7 +2452,7 @@ static void ast_readconfig(void)
|
|||||||
}
|
}
|
||||||
} else if (!strcasecmp(v->name, "languageprefix")) {
|
} else if (!strcasecmp(v->name, "languageprefix")) {
|
||||||
ast_language_is_prefix = ast_true(v->value);
|
ast_language_is_prefix = ast_true(v->value);
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
} else if (!strcasecmp(v->name, "minmemfree")) {
|
} else if (!strcasecmp(v->name, "minmemfree")) {
|
||||||
/* specify the minimum amount of free memory to retain. Asterisk should stop accepting new calls
|
/* specify the minimum amount of free memory to retain. Asterisk should stop accepting new calls
|
||||||
* if the amount of free memory falls below this watermark */
|
* if the amount of free memory falls below this watermark */
|
||||||
@@ -2533,7 +2533,7 @@ int main(int argc, char *argv[])
|
|||||||
/* Check for options */
|
/* Check for options */
|
||||||
while ((c = getopt(argc, argv, "mtThfFdvVqprRgciInx:U:G:C:L:M:e:")) != -1) {
|
while ((c = getopt(argc, argv, "mtThfFdvVqprRgciInx:U:G:C:L:M:e:")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
case 'e':
|
case 'e':
|
||||||
if ((sscanf(&optarg[1], "%ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
|
if ((sscanf(&optarg[1], "%ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
|
||||||
option_minmemfree = 0;
|
option_minmemfree = 0;
|
||||||
|
@@ -37,7 +37,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
#include <sys/sysinfo.h>
|
#include <sys/sysinfo.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2536,7 +2536,7 @@ static int increase_call_count(const struct ast_channel *c)
|
|||||||
{
|
{
|
||||||
int failed = 0;
|
int failed = 0;
|
||||||
double curloadavg;
|
double curloadavg;
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
long curfreemem;
|
long curfreemem;
|
||||||
struct sysinfo sys_info;
|
struct sysinfo sys_info;
|
||||||
#endif
|
#endif
|
||||||
@@ -2555,7 +2555,7 @@ static int increase_call_count(const struct ast_channel *c)
|
|||||||
failed = -1;
|
failed = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if defined(HAVE_SYSINFO)
|
#if defined(HAVE_SYSINFO) && !defined(SOLARIS)
|
||||||
if (option_minmemfree) {
|
if (option_minmemfree) {
|
||||||
if (!sysinfo(&sys_info)) {
|
if (!sysinfo(&sys_info)) {
|
||||||
/* make sure that the free system memory is above the configured low watermark
|
/* make sure that the free system memory is above the configured low watermark
|
||||||
|
Reference in New Issue
Block a user