<p>N A has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/17868">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">cli: Add core dump info to core show settings<br><br>Adds two pieces of information to the core<br>show settings command which are useful in<br>the context of getting backtraces.<br><br>The first is to display whether or not Asterisk<br>would generate a core dump if it were to crash.<br><br>The second is to show the current running<br>directory of Asterisk.<br><br>ASTERISK-29866 #close<br><br>Change-Id: Ic42c0a9ecc233381aad274d86c62808d1ebb4d83<br>---<br>M main/asterisk.c<br>1 file changed, 19 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/68/17868/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/asterisk.c b/main/asterisk.c</span><br><span>index eaf2d7d..2eb89b2 100644</span><br><span>--- a/main/asterisk.c</span><br><span>+++ b/main/asterisk.c</span><br><span>@@ -454,6 +454,7 @@</span><br><span>        char eid_str[128];</span><br><span>   struct rlimit limits;</span><br><span>        char pbx_uuid[AST_UUID_STR_LEN];</span><br><span style="color: hsl(120, 100%, 40%);">+      char dir[PATH_MAX];</span><br><span> </span><br><span>      switch (cmd) {</span><br><span>       case CLI_INIT:</span><br><span>@@ -491,6 +492,7 @@</span><br><span>         ast_cli(a->fd, "  Current console verbosity:   %d\n", ast_verb_console_get());</span><br><span>  ast_cli(a->fd, "  Debug level:                 %d\n", option_debug);</span><br><span>    ast_cli(a->fd, "  Trace level:                 %d\n", option_trace);</span><br><span style="color: hsl(120, 100%, 40%);">+     ast_cli(a->fd, "  Dump core on crash:          %s\n", ast_opt_dump_core ? "Yes" : "No");</span><br><span>    ast_cli(a->fd, "  Maximum load average:        %lf\n", ast_option_maxload);</span><br><span> #if defined(HAVE_SYSINFO)</span><br><span>        ast_cli(a->fd, "  Minimum free memory:         %ld MB\n", option_minmemfree);</span><br><span>@@ -510,6 +512,20 @@</span><br><span>    ast_cli(a->fd, "  Default language:            %s\n", ast_defaultlanguage);</span><br><span>     ast_cli(a->fd, "  Language prefix:             %s\n", ast_language_is_prefix ? "Enabled" : "Disabled");</span><br><span>     ast_cli(a->fd, "  User name and group:         %s/%s\n", ast_config_AST_RUN_USER, ast_config_AST_RUN_GROUP);</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(HAVE_EACCESS) || defined(HAVE_EUIDACCESS)</span><br><span style="color: hsl(120, 100%, 40%);">+#if defined(HAVE_EUIDACCESS) && !defined(HAVE_EACCESS)</span><br><span style="color: hsl(120, 100%, 40%);">+#define eaccess euidaccess</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+  if (!getcwd(dir, sizeof(dir)) || eaccess(dir, R_OK | X_OK | F_OK)) {</span><br><span style="color: hsl(120, 100%, 40%);">+          if (eaccess(dir, R_OK | X_OK | F_OK)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       ast_cli(a->fd, "  Running directory:           %s\n", "Unable to access");</span><br><span style="color: hsl(120, 100%, 40%);">+             } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_cli(a->fd, "  Running directory:           %s (%s)\n", dir, "Unable to access");</span><br><span style="color: hsl(120, 100%, 40%);">+           }</span><br><span style="color: hsl(120, 100%, 40%);">+     } else {</span><br><span style="color: hsl(120, 100%, 40%);">+              ast_cli(a->fd, "  Running directory:           %s\n", dir);</span><br><span style="color: hsl(120, 100%, 40%);">+      }</span><br><span style="color: hsl(120, 100%, 40%);">+#endif /* defined(HAVE_EACCESS) || defined(HAVE_EUIDACCESS) */</span><br><span>    ast_cli(a->fd, "  Executable includes:         %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES) ? "Enabled" : "Disabled");</span><br><span>        ast_cli(a->fd, "  Transcode via SLIN:          %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN) ? "Enabled" : "Disabled");</span><br><span>   ast_cli(a->fd, "  Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled");</span><br><span>@@ -2702,7 +2718,7 @@</span><br><span> </span><br><span>                         /* Write over the CLI prompt */</span><br><span>                      if (!ast_opt_exec && !lastpos) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                if (write(STDOUT_FILENO, "\r", 5) < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+                             if (write(STDOUT_FILENO, "\r[0K", 5) < 0) {</span><br><span>                             }</span><br><span>                    }</span><br><span> </span><br><span>@@ -3862,8 +3878,10 @@</span><br><span>       {</span><br><span> #if defined(HAVE_EACCESS) || defined(HAVE_EUIDACCESS)</span><br><span> #if defined(HAVE_EUIDACCESS) && !defined(HAVE_EACCESS)</span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef eaccess</span><br><span> #define eaccess euidaccess</span><br><span> #endif</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span>                char dir[PATH_MAX];</span><br><span>          if (!getcwd(dir, sizeof(dir)) || eaccess(dir, R_OK | X_OK | F_OK)) {</span><br><span>                         fprintf(stderr, "Unable to access the running directory (%s).  Changing to '/' for compatibility.\n", strerror(errno));</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/17868">change 17868</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/17868"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ic42c0a9ecc233381aad274d86c62808d1ebb4d83 </div>
<div style="display:none"> Gerrit-Change-Number: 17868 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>