Commit Graph

56 Commits

Author SHA1 Message Date
Alexander Traud cc025026b7 progdocs: Fix for Doxygen, the hidden parts.
ASTERISK-29779

Change-Id: If338163488498f65fa7248b60e80299c0a928e4b
2021-12-02 10:37:38 -06:00
Josh Soref f382775241 main: Spelling fixes
Correct typos of the following word families:

analysis
nuisance
converting
although
transaction
desctitle
acquire
update
evaluate
thousand
this
dissolved
management
integrity
reconstructed
decrement
further on
irrelevant
currently
constancy
anyway
unconstrained
featuregroups
right
larger
evaluated
encumbered
languages
digits
authoritative
framing
blindxfer
tolerate
traverser
exclamation
perform
permissions
rearrangement
performing
processing
declension
happily
duplicate
compound
hundred
returns
elicit
allocate
actually
paths
inheritance
atxferdropcall
earlier
synchronization
multiplier
acknowledge
across
against
thousands
joyous
manipulators
guaranteed
emulating
soundfile

ASTERISK-29714

Change-Id: I926ba4b11e9f6dd3fdd93170ab1f9b997910be70
2021-11-15 17:33:27 -06:00
George Joseph e82f2f6e82 astmm.c: Display backtrace with memory show allocations
You can currently capture backtraces of memory allocations but they
only get displayed when you stop asterisk and the atexit hooks
are enabled.  Now, if memory backtrace is on and you issue a
"memory show allocations" CLI command for a specific file, then
a backtrace will show for each allocation that occurred after
you turned "memory backtrace on".  The backtrace display is shown
only when a specific file's allocations are displayed to prevent
a massive CLI dump of every file's allocations.

Change-Id: Ic657afc1fc6ec7205e16eb36a97a611d235a2b4f
2019-09-23 07:25:33 -05:00
George Joseph ece5f8015f backtrace: Refactor ast_bt_get_symbols so it doesn't crash
We've been seeing crashes in libbfd when we attempt to generate
a stack trace from multiple threads.  It turns out that libbfd
is NOT thread-safe.  It can cache the bfd structure and give it to
multiple threads without protecting itself.  To get around this,
we've added a global mutex around the bfd functions and also have
refactored the use of those functions to be more efficient and
to provide more information about inlined functions.

Also added a few more tests to test_pbx.c.  One just calls
ast_assert() and the other calls ast_log_backtrace().  Neither are
run by default.

WARNING:  This change necessitated changing the return value of
ast_bt_get_symbols() from an array of strings to a VECTOR of
strings.  However, the use of this function outside Asterisk is not
likely.

ASTERISK-28140

Change-Id: I79d02862ddaa2423a0809caa4b3b85c128131621
2018-11-19 05:49:39 -07:00
Corey Farrell a10a3aff6a Build System: Improve ccache matching for different menuselect options.
Changing any Menuselect option in the `Compiler Flags` section causes a
full rebuild of the Asterisk source tree.  Every enabled option causes
a #define to be added to buildopts.h, thus breaking ccache caching for
every source file that includes "asterisk.h".  In most cases each option
only applies to one or two files.  Now we only define those options for
the specific sources which use them, this causes much better cache
matching when working with multiple builds.  For example testing code
with an without MALLOC_DEBUG will now use just over half the ccache
size, only main/astmm.o will have two builds cached instead of every
file.

Reorder main/Makefile so _ASTCFLAGS set on specific object files are all
together, sorted by filename.  Stop adding -DMALLOC_DEBUG to CFLAGS of
bundled pjproject, this define is no longer used by any header so only
serves to break cache.

The only code change is a slight adjustment to how main/astmm.c is
initialized.  Initialization functions always exist so main/asterisk.c
can call them unconditionally.  Additionally rename the astmm
initialization functions so they are not exported.

Change-Id: Ie2085237a964f6e1e6fff55ed046e2afff83c027
2018-08-01 12:01:15 -04:00
Corey Farrell 4d1c9d8711 core: Stop using AST_INLINE_API for allocator functions.
This replaces AST_INLINE_API allocators in utils.h with real functions
implemented in astmm.c.  Associated macro's are also moved from utils.h
to astmm.h.

Remove menuselect conflicts between MALLOC_DEBUG and DEBUG_CHAOS as they
can now be combined.

This has multiple benefits:
* Simplifies asterisk/utils.h by removing inline functions and use of
  the logger.
* Removal of these inline functions decreases size of Asterisk and
  module binaries by 1% or more.
* Puts memory management functions together with and without
  MALLOC_DEBUG enabled, simplifying management of the code.
* Enables DEBUG_CHAOS for ASTMM_REDIRECT and bundled pjproject.

Change-Id: If9df4377f74bdbb627461b27a473123e05525887
2018-03-17 01:06:33 -04:00
Richard Mudgett c711e4076a core: Remove ABI effects of MALLOC_DEBUG.
This allows asterisk to be compiled with MALLOC_DEBUG to load modules
built without MALLOC_DEBUG.  Now pre-compiled third-party modules will
still work regardless of MALLOC_DEBUG being enabled or not.

Change-Id: Ic07ad80b2c2df894db984cf27b16a69383ce0e10
2018-03-01 13:13:55 -06:00
Corey Farrell 1b80ffa495 Fix Common Typo's.
Fix instances of:
* Retreive
* Recieve
* other then
* different then
* Repeated words ("the the", "an an", "and and", etc).
* othterwise, teh

ASTERISK-24198 #close

Change-Id: I3809a9c113b92fd9d0d9f9bac98e9c66dc8b2d31
2017-12-20 12:40:01 -05:00
Sean Bright 3f94373778 cli: Fix various CLI documentation and completion issues
* app_minivm: Use built-in completion facilities to complete optional
arguments.

* app_voicemail: Use built-in completion facilities to complete
optional arguments.

* app_confbridge: Add missing colons after 'Usage' text.

* chan_alsa: Use built-in completion facilities to complete optional
arguments.

* chan_sip: Use built-in completion facilities to complete optional
arguments. Add completions for 'load' for 'sip show user', 'sip show
peer', and 'sip qualify peer.'

* chan_skinny: Correct and extend completions for 'skinny reset' and
'skinny show line.'

* func_odbc: Correct completions for 'odbc read' and 'odbc write'

* main/astmm: Use built-in completion facilities to complete arguments
for 'memory' commands.

* main/bridge: Correct completions for 'bridge kick.'

* main/ccss: Use built-in completion facilities to complete arguments
for 'cc cancel' command.

* main/cli: Add 'all' completion for 'channel request hangup.' Correct
completions for 'core set debug channel.' Correct completions for 'core
show calls.'

* main/pbx_app: Remove redundant completions for 'core show
applications.'

* main/pbx_hangup_handler: Remove unused completions for 'core show
hanguphandlers all.'

* res_sorcery_memory_cache: Add completion for 'reload' argument of
'sorcery memory cache stale' and properly implement.

Change-Id: Iee58c7392f6fec34ad9d596109117af87697bbca
2017-02-13 11:33:15 -05:00
Corey Farrell a6e5bae3ef Remove ASTERISK_REGISTER_FILE.
ASTERISK_REGISTER_FILE no longer has any purpose so this commit removes
all traces of it.

Previously exported symbols removed:
* __ast_register_file
* __ast_unregister_file
* ast_complete_source_filename

This also removes the mtx_prof static variable that was declared when
MTX_PROFILE was enabled.  This variable was only used in lock.c so it
is now initialized in that file only.

ASTERISK-26480 #close

Change-Id: I1074af07d71f9e159c48ef36631aa432c86f9966
2016-10-27 09:53:55 -04:00
Richard Mudgett 0a878020dc astmm.c: Add more stats to CLI "memory show" commands.
* Add freed regions totals to allocations and summary.

* Add totals for all allocations and not just the selected allocations.

Change-Id: I61d5a5112617b0733097f2545a3006a344b4032a
2016-01-14 19:57:29 -06:00
Corey Farrell 478fb4a388 MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC.
There are 3 ways that calls directly to standard allocator functions can
be dealt with:
1. Block their use, cause them to generate an error.  This is the default.
2. Replace them with the Asterisk equivalent function calls.
3. Leave them alone.

This change allows one of these 3 options to be selected by any source.
The source just needs to define ASTMM_LIBC to ASTMM_BLOCK, ASTMM_REDIRECT,
or ASTMM_IGNORE to use option 1, 2 or 3 respectively.  Normally ASTMM_BLOCK
is the correct option, so it is default when ASTMM_LIBC is not defined.
In some cases when building 3rd party code it is desirable to have it use
Asterisk functions, without changing the whole source - ASTMM_REDIRECT
accomplishes this.  When using 3rd party libraries sometimes a static
inline function will make use of malloc or free.  In these cases it may
be unsafe to replace the allocator in the header, as it's possible the
memory could be freed by the library using standard allocators.  For
those cases ASTMM_IGNORE is needed.

Change-Id: I8afef4bc7f3b93914263ae27d3a5858b69663fc7
2015-05-13 21:55:07 -04:00
Matt Jordan 4a58261694 git migration: Refactor the ASTERISK_FILE_VERSION macro
Git does not support the ability to replace a token with a version
string during check-in. While it does have support for replacing a
token on clone, this is somewhat sub-optimal: the token is replaced
with the object hash, which is not particularly easy for human
consumption. What's more, in practice, the source file version was often
not terribly useful. Generally, when triaging bugs, the overall version
of Asterisk is far more useful than an individual SVN version of a file. As a
result, this patch removes Asterisk's support for showing source file
versions.

Specifically, it does the following:

* Rename ASTERISK_FILE_VERSION macro to ASTERISK_REGISTER_FILE, and
  remove passing the version in with the macro. Other facilities
  than 'core show file version' make use of the file names, such as
  setting a debug level only on a specific file. As such, the act of
  registering source files with the Asterisk core still has use. The
  macro rename now reflects the new macro purpose.

* main/asterisk:
  - Refactor the file_version structure to reflect that it no longer
    tracks a version field.
  - Remove the "core show file version" CLI command. Without the file
    version, it is no longer useful.
  - Remove the ast_file_version_find function. The file version is no
    longer tracked.
  - Rename ast_register_file_version/ast_unregister_file_version to
    ast_register_file/ast_unregister_file, respectively.

* main/manager: Remove value from the Version key of the ModuleCheck
  Action. The actual key itself has not been removed, as doing so would
  absolutely constitute a backwards incompatible change. However, since
  the file version is no longer tracked, there is no need to attempt to
  include it in the Version key.

* UPGRADE: Add notes for:
  - Modification to the ModuleCheck AMI Action
  - Removal of the "core show file version" CLI command

Change-Id: I6cf0ff280e1668bf4957dc21f32a5ff43444a40e
2015-04-13 03:48:57 -04:00
Corey Farrell 3ddd92902a Replace most uses of ast_register_atexit with ast_register_cleanup.
Since 'core stop now' and 'core restart now' do not stop modules,
it is unsafe for most of the core to run cleanups.  Originally all
cleanups used ast_register_atexit, and were only changed when it
was shown to be unsafe.  ast_register_atexit is now used only when
absolutely required to prevent corruption and close child processes.

Exceptions that need to use ast_register_atexit:
* CDR: Flush records.
* res_musiconhold: Kill external applications.
* AstDB: Close the DB.
* canary_exit: Kill canary process.

ASTERISK-24142 #close
Reported by: David Brillert

ASTERISK-24683 #close
Reported by: Peter Katzmann

ASTERISK-24805 #close
Reported by: Badalian Vyacheslav

ASTERISK-24881 #close
Reported by: Corey Farrell

Review: https://reviewboard.asterisk.org/r/4500/
Review: https://reviewboard.asterisk.org/r/4501/
........

Merged revisions 433495 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 433497 from http://svn.asterisk.org/svn/asterisk/branches/13


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2015-03-26 22:24:26 +00:00
Richard Mudgett 35b5549df8 MALLOC_DEBUG: Change fence magic number to be completely different from the freed magic number.
Race conditions between freeing a nul terminated string and
ast_strdup()'ing it are more likely to be detected if the fence and freed
magic numbers are completely different.
........

Merged revisions 398703 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 398721 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 398726 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@398732 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-09 23:29:44 +00:00
Richard Mudgett 3540c7ac6e Made MALLOC_DEBUG less CPU intensive by default.
Storing a backtrace for each allocation in anticipation of a memory
management problem is very CPU intensive.

* Added the CLI "memory backtrace {on|off}" command to request that the
backtrace be gathered only on request.  The backtrace is off by default.

(issue ASTERISK-22221)
Reported by: Matt Jordan
........

Merged revisions 397809 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397811 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-27 18:52:23 +00:00
Richard Mudgett 46b9e5450f Fix memory corruption when trying to get "core show locks".
Review https://reviewboard.asterisk.org/r/2580/ tried to fix the mismatch
in memory pools but had a math error determining the buffer size and
didn't address other similar memory pool mismatches.

* Effectively reverted the previous patch to go in the same direction as
trunk for the returned memory pool of ast_bt_get_symbols().

* Fixed memory leak in ast_bt_get_symbols() when BETTER_BACKTRACES is
defined.

* Fixed some formatting in ast_bt_get_symbols().

* Fixed sig_pri.c freeing memory allocated by libpri when MALLOC_DEBUG is
enabled.

* Fixed __dump_backtrace() freeing memory from ast_bt_get_symbols() when
MALLOC_DEBUG is enabled.

* Moved __dump_backtrace() because of compile issues with the utils
directory.

(closes issue ASTERISK-22221)
Reported by: Matt Jordan

Review: https://reviewboard.asterisk.org/r/2778/
........

Merged revisions 397525 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 397528 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397570 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-08-23 18:07:40 +00:00
Matthew Jordan c43f380d03 Add backtrace generation to MALLOC_DEBUG memory corruption reports
This patch allows astmm to access the backtrace generation code in Asterisk.
When memory is allocated, a backtrace is created and stored with the memory
region that tracks the allocation. If a memory corruption is detected, the
backtrace is printed to the astmm log. The backtrace will make use of the
BETTER_BACKTRACES build option if available.

As a result, this patch moves the backtrace generation code into its own file
and uses the non-wrapped versions of the C library memory allocation routines.
This allows the memory allocation code to safely use the backtrace generation
routines without infinitely recursing.

Review: https://reviewboard.asterisk.org/r/2567


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391012 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-06-08 22:09:07 +00:00
Richard Mudgett 1d11efe9f4 MALLOC_DEBUG: Only wait if we want atexit allocation dumps.
........

Merged revisions 377398 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 377399 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 377401 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377402 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-12-07 23:45:15 +00:00
Richard Mudgett 2686dde98b Add MALLOC_DEBUG atexit unreleased malloc memory summary.
* Adds the following CLI commands to control MALLOC_DEBUG reporting of
unreleased malloc memory when Asterisk is shut down.
memory atexit list on
memory atexit list off
memory atexit summary byline
memory atexit summary byfunc
memory atexit summary byfile
memory atexit summary off

* Made check all remaining allocated region blocks atexit for fence
violations.

* Increased the allocated region hash table size by about three times.  It
still isn't large enough considering the number of malloced blocks
Asterisk uses.

* Made CLI "memory show allocations anomalies" use
regions_check_all_fences().

Review: https://reviewboard.asterisk.org/r/2196/
........

Merged revisions 376788 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 376789 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 376790 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376791 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-29 00:48:12 +00:00
Richard Mudgett e3a487d492 Enhance MALLOC_DEBUG CLI commands.
* Fixed CLI "memory show allocations" misspelling of anomalies option.
The command will still accept the original misspelling.

* Miscellaneous tweaks to CLI "memory show allocations" command output
format.

* Made CLI "memory show summary" summarize by line number instead of by
function if a filename is given.

* Made CLI "memory show summary" sort its output by filename or
function-name/line-number depending upon request.

* Miscellaneous tweaks to CLI "memory show summary" command output format.
........

Merged revisions 376758 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 376759 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 376760 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376761 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-29 00:07:55 +00:00
Richard Mudgett 3a9640b605 Add MALLOC_DEBUG enhancements.
* Makes malloc() behave like calloc().  It will return a memory block
filled with 0x55.  A nonzero value.

* Makes free() fill the released memory block and boundary fence's with
0xdeaddead.  Any pointer use after free is going to have a pointer
pointing to 0xdeaddead.  The 0xdeaddead pointer is usually an invalid
memory address so a crash is expected.

* Puts the freed memory block into a circular array so it is not reused
immediately.

* When the circular array rotates out a memory block to the heap it checks
that the memory has not been altered from 0xdeaddead.

* Made the astmm_log message wording better.

* Made crash if the DO_CRASH menuselect option is enabled and something is
found.

* Fixed a potential alignment issue on 64 bit systems.
struct ast_region.data[] should now be aligned correctly for all
platforms.

* Extracted region_check_fences() from __ast_free_region() and
handle_memory_show().

* Updated handle_memory_show() CLI usage help.

Review: https://reviewboard.asterisk.org/r/2182/
........

Merged revisions 376029 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 376030 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 376048 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376049 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-11-08 17:38:31 +00:00
Richard Mudgett e315657287 Fix MALLOC_DEBUG version of ast_strndup().
(closes issue ASTERISK-20349)
Reported by: Brent Eagles
........

Merged revisions 372655 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 372656 from http://svn.asterisk.org/svn/asterisk/branches/10
........

Merged revisions 372657 from http://svn.asterisk.org/svn/asterisk/branches/11


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372658 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-09-07 23:10:05 +00:00
Kinsey Moore 9b16c8b0f6 Clean up and ensure proper usage of alloca()
This replaces all calls to alloca() with ast_alloca() which calls gcc's
__builtin_alloca() to avoid BSD semantics and removes all NULL checks
on memory allocated via ast_alloca() and ast_strdupa().

(closes issue ASTERISK-20125)
Review: https://reviewboard.asterisk.org/r/2032/
Patch-by: Walter Doekes (wdoekes)
........

Merged revisions 370642 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 370643 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370655 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-07-31 20:21:43 +00:00
Kevin P. Fleming 166b4e2b30 Multiple revisions 369001-369002
........
  r369001 | kpfleming | 2012-06-15 10:56:08 -0500 (Fri, 15 Jun 2012) | 11 lines
  
  Add support-level indications to many more source files.
  
  Since we now have tools that scan through the source tree looking for files
  with specific support levels, we need to ensure that every file that is
  a component of a 'core' or 'extended' module (or the main Asterisk binary)
  is explicitly marked with its support level. This patch adds support-level
  indications to many more source files in tree, but avoids adding them to
  third-party libraries that are included in the tree and to source files
  that don't end up involved in Asterisk itself.
........
  r369002 | kpfleming | 2012-06-15 10:57:14 -0500 (Fri, 15 Jun 2012) | 3 lines
  
  Add a script to enable finding source files without support-levels defined.
........

Merged revisions 369001-369002 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 369005 from http://svn.asterisk.org/svn/asterisk/branches/10


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369013 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-06-15 16:20:16 +00:00
Kinsey Moore c5b3db1956 Kill off red blobs in most of main/*
Everything still compiled after making these changes, so I assume these
whitespace-only changes didn't break anything (and shouldn't have).


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@360190 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2012-03-22 19:51:16 +00:00
Tilghman Lesher 3c7db3b7e8 Two more minor fixes due to constification
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196272 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-05-22 16:53:41 +00:00
Eliel C. Sardanons 1e8e12efcf Janitor, use ARRAY_LEN() when possible.
(closes issue #13990)
Reported by: eliel
Patches:
      array_len.diff uploaded by eliel (license 64)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@161218 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-12-05 10:31:25 +00:00
Mark Michelson 07a22680ee If malloc returns NULL, we need to return NULL immediately or
else Asterisk will crash when attempting to dereference the NULL
pointer

(closes issue #13858)
Reported by: eliel
Patches:
      astmm.c.patch uploaded by eliel (license 64)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@157632 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-11-19 00:59:48 +00:00
Kevin P. Fleming 629861a705 Merged revisions 144924-144925 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r144924 | kpfleming | 2008-09-27 10:00:48 -0500 (Sat, 27 Sep 2008) | 6 lines
  
  improve header inclusion process in a few small ways:
  
    - it is no longer necessary to forcibly include asterisk/autoconfig.h; every module already includes asterisk.h as its first header (even before system headers), which serves the same purpose
    - astmm.h is now included by asterisk.h when needed, instead of being forced by the Makefile; this means external modules will build properly against installed headers with MALLOC_DEBUG enabled
    - simplify the usage of some of these headers in the AEL-related stuff in the utils directory
........
  r144925 | kpfleming | 2008-09-27 10:13:30 -0500 (Sat, 27 Sep 2008) | 2 lines
  
  fix some minor issues with rev 144924
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@144949 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-27 15:52:56 +00:00
Mark Michelson 48ffe6e772 If attempting to free a NULL pointer when MALLOC_DEBUG
is set, don't bother searching for a region to free, just
immediately exit.

This has the dual benefit of suppressing a warning message
about freeing memory at (nil) and of optimizing the free()
replacement by not having to do any futile searching for
the proper region to free.

(closes issue #13498)
Reported by: pj
Patches:
      13498.patch uploaded by putnopvut (license 60)
Tested by: pj



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@143400 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-09-17 20:25:40 +00:00
Kevin P. Fleming 0024d6846e Merged revisions 129966 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r129966 | kpfleming | 2008-07-11 09:03:52 -0500 (Fri, 11 Jul 2008) | 5 lines

fix a flaw found while experimenting with structure alignment and padding; low-fence checking would not work properly on 64-bit platforms, because the compiler was putting 4 bytes of padding between the fence field and the allocation memory block

added a very obvious runtime warning if this condition reoccurs, so the developer who broke it can be chastised into fixing it :-)


........
r129967 | kpfleming | 2008-07-11 09:03:52 -0500 (Fri, 11 Jul 2008) | 5 lines

simplify calculation

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@129968 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-07-11 14:16:15 +00:00
Mark Michelson fe9821cc10 Get rid of any remaining ast_verbose calls in the code in favor of
ast_verb

(closes issue #11934)
Reported by: mvanbaak
Patches:
      20080205_astverb-2.diff.txt uploaded by mvanbaak (license 7)



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@102525 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-02-05 23:00:15 +00:00
James Golovich 8bcc2a55ae Increase the size of filenames stored when astmm is used. If the path
length was long they would be truncated and grouped together with 
whatever matches



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@100224 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2008-01-24 18:35:04 +00:00
Luigi Rizzo fd88390af7 remove unnecessary (char *) casts for ast_config_AST_* variables.
There are some left in the .flex files, left to the maintainer...



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@93582 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-12-18 09:46:18 +00:00
Luigi Rizzo e0ff5fef5c remove a bunch of useless #include "options.h"
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89511 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 23:09:02 +00:00
Luigi Rizzo 9d7ddb3c63 add missing paths.h
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89476 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-21 01:35:30 +00:00
Luigi Rizzo 9335ace850 another bunch of include removals (errno.h and asterisk/logger.h)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-19 19:09:03 +00:00
Luigi Rizzo fdb7f7ba3d Start untangling header inclusion in a way that does not affect
build times - tested, there is no measureable difference before and
after this commit.

In this change:

use asterisk/compat.h to include a small set of system headers:
inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h,
stdlib.h, alloca.h, stdio.h

Where available, the inclusion is conditional on HAVE_FOO_H as determined
by autoconf.

Normally, source files should not include any of the above system headers,
and instead use either "asterisk.h" or "asterisk/compat.h" which does it
better. 

For the time being I have left alone second-level directories
(main/db1-ast, etc.).



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16 20:04:58 +00:00
Russell Bryant 5480c54e56 Fix another CLI command so it doesn't run the real code when called for initialization.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89076 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-07 00:16:03 +00:00
Russell Bryant 5ab1541da9 Fix the memory show allocations CLI command so that it doesn't spew out all
of the current memory allocations when you start Asterisk, when the command's
handler gets called for initialization.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89052 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-06 19:51:37 +00:00
Russell Bryant 70db49ae2f Merged revisions 87373 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r87373 | russell | 2007-10-29 14:21:06 -0500 (Mon, 29 Oct 2007) | 5 lines

Remove a lock that doesn't make any sense.  The regions lock needs to be held
when traversing the list of allocated chunks so that they can be printed out
to the CLI.
(Thanks to eliel on #asterisk-dev for pointing this out!)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@87392 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-29 19:47:52 +00:00
Jason Parker ebe4050128 Switch from AST_CLI (formerly NEW_CLI) to AST_CLI_DEFINE, since the former didn't make much sense
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22 20:05:18 +00:00
Tilghman Lesher 8711a1dba7 Merged revisions 86787 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r86787 | tilghman | 2007-10-22 12:38:13 -0500 (Mon, 22 Oct 2007) | 2 lines

Minor FreeBSD build fix

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22 17:40:29 +00:00
Jason Parker b0f3e6097e Convert NEW_CLI to AST_CLI.
Closes issue #11039, as suggested by seanbright.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19 18:29:40 +00:00
Jason Parker 857f785a40 More NEW_CLI conversions.
(issue #10724)
Patches:
      app_playback.c.patch uploaded by moy (license 222)
      app_minivm.c.patch uploaded by eliel (license 64)
      astmm.c.patch uploaded by eliel (license 64)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83381 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-20 23:14:30 +00:00
Russell Bryant befb383d16 Merged revisions 78095 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r78095 | russell | 2007-08-03 14:39:49 -0500 (Fri, 03 Aug 2007) | 28 lines

Add some improvements to lock debugging.  These changes take effect
with DEBUG_THREADS enabled and provide the following:

 * This will keep track of which locks are held by which thread as well as
   which lock a thread is waiting for in a thread-local data structure.  A
   reference to this structure is available on the stack in the dummy_start()
   function, which is the common entry point for all threads.  This information
   can be easily retrieved using gdb if you switch to the dummy_start() stack
   frame of any thread and print the contents of the lock_info variable.

 * All of the thread-local structures for keeping track of this lock information
   are also stored in a list so that the information can be dumped to the CLI
   using the "core show locks" CLI command.  This introduces a little bit of a
   performance hit as it requires additional underlying locking operations
   inside of every lock/unlock on an ast_mutex.  However, the benefits of
   having this information available at the CLI is huge, especially considering
   this is only done in DEBUG_THREADS mode.  It means that in most cases where
   we debug deadlocks, we no longer have to request access to the machine to
   analyze the contents of ast_mutex_t structures.  We can now just ask them
   to get the output of "core show locks", which gives us all of the information
   we needed in most cases.

I also had to make some additional changes to astmm.c to make this work when
both MALLOC_DEBUG and DEBUG_THREADS are enabled.  I disabled tracking of one
of the locks in astmm.c because it gets used inside the replacement memory
allocation routines, and the lock tracking code allocates memory.  This caused
infinite recursion.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78096 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-03 19:41:42 +00:00
Joshua Colp 35ce830d76 Merged revisions 50820 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r50820 | file | 2007-01-14 16:59:05 -0500 (Sun, 14 Jan 2007) | 2 lines

Add missing newlines for two memory CLI commands.

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50821 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-14 22:00:51 +00:00
Kevin P. Fleming d68c7c8ce6 Merged revisions 48987 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r48987 | kpfleming | 2006-12-27 12:29:13 -0600 (Wed, 27 Dec 2006) | 2 lines

allow 'show memory' and 'show memory summary' to distinguish memory allocations that were done for caching purposes, so they don't look like memory leaks

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@48989 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-12-27 18:33:44 +00:00
Tilghman Lesher 2b55678e1f Remove deprecated CLI apps from the core
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43449 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-09-21 21:17:39 +00:00