summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorzuul <zuul@gerrit.asterisk.org>2016-06-10 15:50:35 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-06-10 15:50:35 -0500
commitd9b5aea9c3309865a14f5eed006bbc1456764d78 (patch)
treef596173e161a33c201315471191f9687c811d683 /main
parentd1006faba9b14ece06966e3d60eb0d5f722ac82b (diff)
parentac683f13c9d377b41aee36c665057d64d28420e5 (diff)
Merge "core: Not the configured but granted number of possible file descriptors."
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 25c6c9569..95f1b3ed0 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -596,6 +596,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:
@@ -617,10 +618,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);