add realloc OS hooks and fix boost pri CLI
This commit is contained in:
parent
882cb5725c
commit
0bf8482393
|
@ -3,8 +3,9 @@
|
||||||
# FreeSWITCH is trunk is located at ../../
|
# FreeSWITCH is trunk is located at ../../
|
||||||
fsdir=../..
|
fsdir=../..
|
||||||
set -x
|
set -x
|
||||||
cp Debug/*.dll $fsdir/Debug/
|
|
||||||
cp Debug/mod/*.dll $fsdir/Debug/mod/
|
cp Debug/mod/*.dll $fsdir/Debug/mod/
|
||||||
|
cp mod_freetdm/Debug/*.pdb $fsdir/Debug/mod/
|
||||||
|
cp Debug/*.dll $fsdir/Debug/
|
||||||
cp Debug/*.pdb $fsdir/Debug/
|
cp Debug/*.pdb $fsdir/Debug/
|
||||||
echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS"
|
echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS"
|
||||||
set +x
|
set +x
|
||||||
|
|
|
@ -54,6 +54,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testboost", "msvc\testboost
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsangomaboost", "msvc\testboost\testsangomaboost.2008.vcproj", "{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsangomaboost", "msvc\testboost\testsangomaboost.2008.vcproj", "{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}"
|
||||||
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D}
|
||||||
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
RandomizedBaseAddress="1"
|
RandomizedBaseAddress="1"
|
||||||
DataExecutionPrevention="0"
|
DataExecutionPrevention="0"
|
||||||
|
@ -151,7 +151,7 @@
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
EnableCOMDATFolding="2"
|
EnableCOMDATFolding="2"
|
||||||
|
@ -237,7 +237,7 @@
|
||||||
LinkIncremental="2"
|
LinkIncremental="2"
|
||||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
RandomizedBaseAddress="1"
|
RandomizedBaseAddress="1"
|
||||||
DataExecutionPrevention="0"
|
DataExecutionPrevention="0"
|
||||||
|
@ -317,7 +317,7 @@
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
AdditionalLibraryDirectories=""../../../w32/Library/$(OutDir)""
|
||||||
GenerateDebugInformation="true"
|
GenerateDebugInformation="true"
|
||||||
ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
|
ProgramDatabaseFile="$(OutDir)/$(TargetName).pdb"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
OptimizeReferences="2"
|
OptimizeReferences="2"
|
||||||
EnableCOMDATFolding="2"
|
EnableCOMDATFolding="2"
|
||||||
|
|
|
@ -3108,11 +3108,12 @@ SWITCH_STANDARD_API(ft_function)
|
||||||
}
|
}
|
||||||
stream->write_function(stream, "+OK gains set to Rx %f and Tx %f\n", rxgain, txgain);
|
stream->write_function(stream, "+OK gains set to Rx %f and Tx %f\n", rxgain, txgain);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
char *rply = ftdm_api_execute(cmd, NULL);
|
char *rply = ftdm_api_execute(cmd, NULL);
|
||||||
|
|
||||||
if (rply) {
|
if (rply) {
|
||||||
stream->write_function(stream, "%s", rply);
|
stream->write_function(stream, "%s", rply);
|
||||||
free(rply);
|
ftdm_safe_free(rply);
|
||||||
} else {
|
} else {
|
||||||
stream->write_function(stream, "-ERR Usage: %s\n", FT_SYNTAX);
|
stream->write_function(stream, "-ERR Usage: %s\n", FT_SYNTAX);
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,6 +223,14 @@ static __inline__ void *ftdm_std_calloc(void *pool, ftdm_size_t elements, ftdm_s
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __inline__ void *ftdm_std_realloc(void *pool, void *buff, ftdm_size_t size)
|
||||||
|
{
|
||||||
|
buff = realloc(buff, size);
|
||||||
|
pool = NULL;
|
||||||
|
ftdm_assert_return(buff != NULL, NULL, "Out of memory");
|
||||||
|
return buff;
|
||||||
|
}
|
||||||
|
|
||||||
static __inline__ void ftdm_std_free(void *pool, void *ptr)
|
static __inline__ void ftdm_std_free(void *pool, void *ptr)
|
||||||
{
|
{
|
||||||
pool = NULL;
|
pool = NULL;
|
||||||
|
@ -235,6 +243,7 @@ FT_DECLARE_DATA ftdm_memory_handler_t g_ftdm_mem_handler =
|
||||||
/*.pool =*/ NULL,
|
/*.pool =*/ NULL,
|
||||||
/*.malloc =*/ ftdm_std_malloc,
|
/*.malloc =*/ ftdm_std_malloc,
|
||||||
/*.calloc =*/ ftdm_std_calloc,
|
/*.calloc =*/ ftdm_std_calloc,
|
||||||
|
/*.realloc =*/ ftdm_std_realloc,
|
||||||
/*.free =*/ ftdm_std_free
|
/*.free =*/ ftdm_std_free
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4081,7 +4090,7 @@ FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_write(ftdm_stream_handle_t
|
||||||
void *new_data;
|
void *new_data;
|
||||||
|
|
||||||
new_len = handle->data_size + need + handle->alloc_chunk;
|
new_len = handle->data_size + need + handle->alloc_chunk;
|
||||||
if ((new_data = realloc(handle->data, new_len))) {
|
if ((new_data = ftdm_realloc(handle->data, new_len))) {
|
||||||
handle->data_size = handle->alloc_len = new_len;
|
handle->data_size = handle->alloc_len = new_len;
|
||||||
handle->data = new_data;
|
handle->data = new_data;
|
||||||
buf = handle->data;
|
buf = handle->data;
|
||||||
|
|
|
@ -1798,7 +1798,7 @@ static FIO_API_FUNCTION(ftdm_sangoma_boost_api)
|
||||||
if (sigmod_iface) {
|
if (sigmod_iface) {
|
||||||
char *p = strchr(data, ' ');
|
char *p = strchr(data, ' ');
|
||||||
if (++p) {
|
if (++p) {
|
||||||
char* mydup = strdup(p);
|
char* mydup = ftdm_strdup(p);
|
||||||
if(sigmod_iface->exec_api == NULL) {
|
if(sigmod_iface->exec_api == NULL) {
|
||||||
stream->write_function(stream, "%s does not support api functions\n", sigmod_iface->name);
|
stream->write_function(stream, "%s does not support api functions\n", sigmod_iface->name);
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -1807,7 +1807,7 @@ static FIO_API_FUNCTION(ftdm_sangoma_boost_api)
|
||||||
if (sigmod_iface->exec_api(stream, mydup) != FTDM_SUCCESS) {
|
if (sigmod_iface->exec_api(stream, mydup) != FTDM_SUCCESS) {
|
||||||
stream->write_function(stream, "-ERR:failed to execute command:%s\n", mydup);
|
stream->write_function(stream, "-ERR:failed to execute command:%s\n", mydup);
|
||||||
}
|
}
|
||||||
free(mydup);
|
ftdm_safe_free(mydup);
|
||||||
}
|
}
|
||||||
|
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
@ -364,7 +364,7 @@ FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_raw_write(ftdm_stream_handl
|
||||||
FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_write(ftdm_stream_handle_t *handle, const char *fmt, ...);
|
FT_DECLARE_NONSTD(ftdm_status_t) ftdm_console_stream_write(ftdm_stream_handle_t *handle, const char *fmt, ...);
|
||||||
|
|
||||||
#define FTDM_CMD_CHUNK_LEN 1024
|
#define FTDM_CMD_CHUNK_LEN 1024
|
||||||
#define FTDM_STANDARD_STREAM(s) memset(&s, 0, sizeof(s)); s.data = malloc(FTDM_CMD_CHUNK_LEN); \
|
#define FTDM_STANDARD_STREAM(s) memset(&s, 0, sizeof(s)); s.data = ftdm_malloc(FTDM_CMD_CHUNK_LEN); \
|
||||||
assert(s.data); \
|
assert(s.data); \
|
||||||
memset(s.data, 0, FTDM_CMD_CHUNK_LEN); \
|
memset(s.data, 0, FTDM_CMD_CHUNK_LEN); \
|
||||||
s.end = s.data; \
|
s.end = s.data; \
|
||||||
|
@ -681,11 +681,13 @@ FT_DECLARE_DATA extern ftdm_crash_policy_t g_ftdm_crash_policy;
|
||||||
|
|
||||||
typedef void *(*ftdm_malloc_func_t)(void *pool, ftdm_size_t len);
|
typedef void *(*ftdm_malloc_func_t)(void *pool, ftdm_size_t len);
|
||||||
typedef void *(*ftdm_calloc_func_t)(void *pool, ftdm_size_t elements, ftdm_size_t len);
|
typedef void *(*ftdm_calloc_func_t)(void *pool, ftdm_size_t elements, ftdm_size_t len);
|
||||||
|
typedef void *(*ftdm_realloc_func_t)(void *pool, void *buff, ftdm_size_t len);
|
||||||
typedef void (*ftdm_free_func_t)(void *pool, void *ptr);
|
typedef void (*ftdm_free_func_t)(void *pool, void *ptr);
|
||||||
typedef struct ftdm_memory_handler {
|
typedef struct ftdm_memory_handler {
|
||||||
void *pool;
|
void *pool;
|
||||||
ftdm_malloc_func_t malloc;
|
ftdm_malloc_func_t malloc;
|
||||||
ftdm_calloc_func_t calloc;
|
ftdm_calloc_func_t calloc;
|
||||||
|
ftdm_realloc_func_t realloc;
|
||||||
ftdm_free_func_t free;
|
ftdm_free_func_t free;
|
||||||
} ftdm_memory_handler_t;
|
} ftdm_memory_handler_t;
|
||||||
|
|
||||||
|
@ -873,6 +875,13 @@ FIO_CODEC_FUNCTION(fio_alaw2ulaw);
|
||||||
*/
|
*/
|
||||||
#define ftdm_malloc(chunksize) g_ftdm_mem_handler.malloc(g_ftdm_mem_handler.pool, chunksize)
|
#define ftdm_malloc(chunksize) g_ftdm_mem_handler.malloc(g_ftdm_mem_handler.pool, chunksize)
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Reallocates memory
|
||||||
|
\command buff the buffer
|
||||||
|
\command chunksize the chunk size
|
||||||
|
*/
|
||||||
|
#define ftdm_realloc(buff, chunksize) g_ftdm_mem_handler.realloc(g_ftdm_mem_handler.pool, buff, chunksize)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Allocate initialized memory
|
\brief Allocate initialized memory
|
||||||
\command chunksize the chunk size
|
\command chunksize the chunk size
|
||||||
|
|
Loading…
Reference in New Issue