#include <grp.h>
#include <pwd.h>
#include <sys/stat.h>
+#if HAVE_SYSINFO
#include <sys/sysinfo.h>
+#endif
#ifdef linux
#include <sys/prctl.h>
#ifdef HAVE_CAP
double option_maxload; /*!< Max load avg on system */
int option_maxcalls; /*!< Max number of active calls */
int option_maxfiles; /*!< Max number of open file handles (files, sockets) */
+#if HAVE_SYSINFO
long option_minmemfree; /*!< Minimum amount of free system memory - stop accepting calls if free memory falls below this watermark */
+#endif
/*! @} */
ast_cli(fd, " Verbosity: %d\n", option_verbose);
ast_cli(fd, " Debug level: %d\n", option_debug);
ast_cli(fd, " Max load avg: %lf\n", option_maxload);
+#if HAVE_SYSINFO
ast_cli(fd, " Min Free Memory: %ld MB\n", option_minmemfree);
+#endif
if (localtime_r(&ast_startuptime, &tm)) {
strftime(buf, sizeof(buf), "%H:%M:%S", &tm);
ast_cli(fd, " Startup time: %s\n", buf);
return 0;
}
+#if HAVE_SYSINFO
static const char show_sysinfo_help[] =
"Usage: core show sysinfo\n"
" List current system information.\n";
ast_cli(fd, " Number of Processes: %d \n\n", sys_info.procs);
return 0;
}
+#endif
struct profile_entry {
const char *name;
handle_show_threads, "Show running threads",
show_threads_help },
+#if HAVE_SYSINFO
{ { "core", "show", "sysinfo", NULL },
handle_show_sysinfo, "Show System Information",
show_sysinfo_help },
+#endif
{ { "core", "show", "profile", NULL },
handle_show_profile, "Display profiling info",
ast_copy_string(ast_config_AST_SYSTEM_NAME, v->value, sizeof(ast_config_AST_SYSTEM_NAME));
} else if (!strcasecmp(v->name, "languageprefix")) {
ast_language_is_prefix = ast_true(v->value);
+#if HAVE_SYSINFO
} else if (!strcasecmp(v->name, "minmemfree")) {
/* 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 ((sscanf(v->value, "%ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
option_minmemfree = 0;
}
+#endif
}
}
ast_config_destroy(cfg);
if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
/* Check for options */
- while ((c = getopt(argc, argv, "mtThfFdvVqprRgciInx:U:G:C:L:M:")) != -1) {
+ while ((c = getopt(argc, argv, "mtThfFdvVqprRgciInx:U:G:C:L:M:e:")) != -1) {
switch (c) {
+#if HAVE_SYSINFO
case 'e':
if ((sscanf(optarg, "%ld", &option_minmemfree) != 1) || (option_minmemfree < 0)) {
option_minmemfree = 0;
}
break;
+#endif
#if HAVE_WORKING_FORK
case 'F':
ast_set_flag(&ast_options, AST_OPT_FLAG_ALWAYS_FORK);