summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Traud <pabstraud@compuserve.com>2016-06-08 13:15:15 +0200
committerAlexander Traud <pabstraud@compuserve.com>2016-06-10 14:07:03 -0500
commitca38a3cbb48a27160d764459123053f930a2bec6 (patch)
tree39059f28beb18b6d273f262f04fab3a129d0f39b
parentc2f68787a34082e61ee0439baefd5ce435501a97 (diff)
core: Not the configured but granted number of possible file descriptors.
With CLI "core show settings", simply the parameter maxfiles of the file asterisk.conf was shown. If that parameter was not set, nothing was displayed although the environment might have set a default number itself. Or if maxfiles were not granted (completely), still maxfiles was shown. Now, the maximum number of possible file descriptors in the environment is shown. ASTERISK-26097 Change-Id: I2df5c58863b5007b34b77adbe28b885dfcdf7e0b
-rw-r--r--main/asterisk.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index ea998d492..164e659ba 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -606,6 +606,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c
char buf[BUFSIZ];
struct ast_tm tm;
char eid_str[128];
+ struct rlimit limits;
switch (cmd) {
case CLI_INIT:
@@ -627,10 +628,17 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c
ast_cli(a->fd, " Maximum calls: %d (Current %d)\n", ast_option_maxcalls, ast_active_channels());
else
ast_cli(a->fd, " Maximum calls: Not set\n");
- if (ast_option_maxfiles)
- ast_cli(a->fd, " Maximum open file handles: %d\n", ast_option_maxfiles);
- else
- ast_cli(a->fd, " Maximum open file handles: Not set\n");
+
+ if (getrlimit(RLIMIT_NOFILE, &limits)) {
+ ast_cli(a->fd, " Maximum open file handles: Error because of %s\n", strerror(errno));
+ } else if (limits.rlim_cur == RLIM_INFINITY) {
+ ast_cli(a->fd, " Maximum open file handles: Unlimited\n");
+ } else if (limits.rlim_cur < ast_option_maxfiles) {
+ ast_cli(a->fd, " Maximum open file handles: %d (is) %d (requested)\n", (int) limits.rlim_cur, ast_option_maxfiles);
+ } else {
+ ast_cli(a->fd, " Maximum open file handles: %d\n", (int) limits.rlim_cur);
+ }
+
ast_cli(a->fd, " Root console verbosity: %d\n", option_verbose);
ast_cli(a->fd, " Current console verbosity: %d\n", ast_verb_console_get());
ast_cli(a->fd, " Debug level: %d\n", option_debug);