move stacksize thing into the core deeper to avoid build issues
This commit is contained in:
parent
2b17e82dd4
commit
c5ba5acbd5
|
@ -2332,7 +2332,7 @@ SWITCH_DECLARE(int) switch_max_file_desc(void);
|
||||||
SWITCH_DECLARE(void) switch_close_extra_files(int *keep, int keep_ttl);
|
SWITCH_DECLARE(void) switch_close_extra_files(int *keep, int keep_ttl);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu);
|
SWITCH_DECLARE(switch_status_t) switch_core_thread_set_cpu_affinity(int cpu);
|
||||||
SWITCH_DECLARE(void) switch_os_yield(void);
|
SWITCH_DECLARE(void) switch_os_yield(void);
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_get_stacksizes(switch_size_t *cur, switch_size_t *max);
|
||||||
SWITCH_END_EXTERN_C
|
SWITCH_END_EXTERN_C
|
||||||
#endif
|
#endif
|
||||||
/* For Emacs:
|
/* For Emacs:
|
||||||
|
|
|
@ -1721,14 +1721,6 @@ SWITCH_STANDARD_API(lan_addr_function)
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
#include "switch_private.h"
|
|
||||||
#ifdef HAVE_SETRLIMIT
|
|
||||||
#include <sys/resource.h>
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
SWITCH_STANDARD_API(status_function)
|
SWITCH_STANDARD_API(status_function)
|
||||||
{
|
{
|
||||||
uint8_t html = 0;
|
uint8_t html = 0;
|
||||||
|
@ -1736,11 +1728,7 @@ SWITCH_STANDARD_API(status_function)
|
||||||
char *http = NULL;
|
char *http = NULL;
|
||||||
int sps = 0, last_sps = 0;
|
int sps = 0, last_sps = 0;
|
||||||
const char *var;
|
const char *var;
|
||||||
#ifdef HAVE_SETRLIMIT
|
switch_size_t cur = 0, max = 0;
|
||||||
struct rlimit rlp;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch_core_measure_time(switch_core_uptime(), &duration);
|
switch_core_measure_time(switch_core_uptime(), &duration);
|
||||||
|
|
||||||
|
@ -1777,13 +1765,10 @@ SWITCH_STANDARD_API(status_function)
|
||||||
stream->write_function(stream, "%d session(s) max\n", switch_core_session_limit(0));
|
stream->write_function(stream, "%d session(s) max\n", switch_core_session_limit(0));
|
||||||
stream->write_function(stream, "min idle cpu %0.2f/%0.2f\n", switch_core_min_idle_cpu(-1.0), switch_core_idle_cpu());
|
stream->write_function(stream, "min idle cpu %0.2f/%0.2f\n", switch_core_min_idle_cpu(-1.0), switch_core_idle_cpu());
|
||||||
|
|
||||||
#ifdef HAVE_SETRLIMIT
|
|
||||||
memset(&rlp, 0, sizeof(rlp));
|
|
||||||
getrlimit(RLIMIT_STACK, &rlp);
|
|
||||||
|
|
||||||
stream->write_function(stream, "Current Stack Size/Max %ldK/%ldK\n", rlp.rlim_cur / 1024, rlp.rlim_max / 1024);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
if (switch_core_get_stacksizes(&cur, &max) == SWITCH_STATUS_SUCCESS) {
|
||||||
|
stream->write_function(stream, "Current Stack Size/Max %ldK/%ldK\n", cur / 1024, max / 1024);
|
||||||
|
}
|
||||||
|
|
||||||
if (html) {
|
if (html) {
|
||||||
stream->write_function(stream, "</b>\n");
|
stream->write_function(stream, "</b>\n");
|
||||||
|
|
|
@ -2647,6 +2647,30 @@ SWITCH_DECLARE(int) switch_stream_system_fork(const char *cmd, switch_stream_han
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_status_t) switch_core_get_stacksizes(switch_size_t *cur, switch_size_t *max)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_SETRLIMIT
|
||||||
|
struct rlimit rlp;
|
||||||
|
|
||||||
|
memset(&rlp, 0, sizeof(rlp));
|
||||||
|
getrlimit(RLIMIT_STACK, &rlp);
|
||||||
|
|
||||||
|
*cur = rlp.rlim_cur;
|
||||||
|
*max = rlp.rlim_max;
|
||||||
|
|
||||||
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
return SWITCH_STATUS_FALSE;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream)
|
SWITCH_DECLARE(int) switch_stream_system(const char *cmd, switch_stream_handle_t *stream)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
Loading…
Reference in New Issue