dect
/
asterisk
Archived
13
0
Fork 0
Commit Graph

119 Commits

Author SHA1 Message Date
jpeeler 96c454daea Add new unit test for stringfields.
(Copied from reviewboard)
Tests the following:
1. Basic allocation and setting of string fields.
2. Shrinking a string field and re-expanding it.
3. Growing the last allocation in a string field pool.
4. Setting a string to a large value such that a new string field pool must be
allocated.
In each part, we make sure that the string field is accurate (has the correct
value in it), make sure that the 2 bytes before the string field has the correct
capacity for the field, and for tests 2-4, we make sure that the string field is
where we expect it to be in memory.

Also tested:
5. Shrinking a string field and partially re-expanding it.
6. Setting strings in such a way as to create three separate string field pools
and then removing the middle pool.

There is a bug fix in the init function, which ensures the embedded_pool is set
to NULL which is important for stack allocated structures.

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


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@251736 f38db490-d61c-443f-a65b-d21fe96a405b
2010-03-10 23:15:55 +00:00
dvossel 1bc7ad599c RFC compliant uri and display-name encode/decode
1.  URI Encoding
This patch changes ast_uri_encode()'s behavior when doreserved is enabled.
Previously when doreserved was enabled only a small set of reserved
characters were encoded.  This set was comprised primarily of the reserved
characters defined in RFC3261 section 25.1, but contained other characters as
well.  Rather than only escaping the reserved set, doreserved now escapes
all characters not within the unreserved set as defined by RFC 3261 and
RFC 2396.  Also, the 'doreserved' variable has been renamed to 'do_special_char'
in attempts to avoid confusion.

When doreserve is not enabled, the previous logic of only encoding the
characters <= 0X1F and > 0X7f remains, except for the '%' character, which
must always be encoded as it signifies a HEX escaped character during the decode
process.

2. URI Decoding: Break up URI before decode.
In chan_sip.c ast_uri_decode is called on the entire URI instead of it's
individual parts after it is parsed.  This is not good as ast_uri_decode
can introduce special characters back into the URI which can mess up parsing.
This patch resolves this by not decoding a URI until parsing is completely
done.  There are many instances where we check to see if pedantic checking
is enabled before we decode a URI.  In these cases a new macro,
SIP_PEDANTIC_DECODE, is used on the individual parsed segments of the URI
rather than constantly putting if (pedantic) { decode() } checks everywhere
in the code.  In the areas where ast_uri_decode is not dependent upon
pedantic checking this macro is not used, but decoding is still moved to
each individual part of the URI.  The only behavior that should change from
this patch is the time at which decoding occurs.

Since I had to look over every place URI parsing occurs to create this
patch, I found several places where we use duplicate code for parsing.
To consolidate the code, those areas have updated to use the parse_uri()
function where possible.

3. SIP display-name decoding according to RFC3261 section 25.
To properly decode the display-name portion of a FROM header, chan_sip's
get_calleridname() function required a complete re-write.  More information
about this change can be found in the comments at the beginning of this function.

4. Unit Tests.
Unit tests for ast_uri_encode, ast_uri_decode, and get_calleridname() have been
written.  This involved the addition of the test_utils.c file for testing the
utils api.

(closes issue #16299)
Reported by: wdoekes
Patches:
      astsvn-16299-get_calleridname.diff uploaded by wdoekes (license 717)
      get_calleridname_rewrite.diff uploaded by dvossel (license 671)
Tested by: wdoekes, dvossel, Nick_Lewis

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



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@243200 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-26 16:30:08 +00:00
mmichelson 36ba567f70 Make sure to set owner_line, ownder_func, and owner_file in ast_calloc_with_stringfields.
Asterisk would crash on startup if MALLOC_DEBUG were set in menuselect. This is because
the manager action UpdateConfig had to resize its string field allocation to set the
description. When the resize occurred, ast_copy_string would crash because we were
attempting to copy a string from a NULL pointer. Setting the strings initially makes
the code much less crashy.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@240420 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-15 20:58:24 +00:00
russell 8e1f5b4d31 Fix build of utility apps that include utils.c.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@237749 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-05 17:26:50 +00:00
russell e9e7af54ac Merged revisions 237697 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r237697 | russell | 2010-01-05 11:13:28 -0600 (Tue, 05 Jan 2010) | 7 lines
  
  Change a NOTICE log message to DEBUG where it belongs.
  
  (closes issue #16479)
  Reported by: alexrecarey
  
  (closes SWP-577)
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@237699 f38db490-d61c-443f-a65b-d21fe96a405b
2010-01-05 17:16:01 +00:00
dvossel 9f320becac fixes incorrect logic in ast_uri_encode
issue #16299


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@233611 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-07 23:28:51 +00:00
mnicholson c5f892ebec Merged revisions 228378 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r228378 | mnicholson | 2009-11-06 10:26:59 -0600 (Fri, 06 Nov 2009) | 8 lines
  
  Properly handle '=' while decoding base64 messages and null terminate strings returned from BASE64_DECODE.
  
  (closes issue #15271)
  Reported by: chappell
  Patches:
        base64_fix.patch uploaded by chappell (license 8)
  Tested by: kobaz
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@228620 f38db490-d61c-443f-a65b-d21fe96a405b
2009-11-06 19:47:11 +00:00
mvanbaak 7acc8bcaf3 Merged revisions 216435 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r216435 | mvanbaak | 2009-09-04 15:56:10 +0200 (Fri, 04 Sep 2009) | 2 lines
  
  make asterisk compile under devmode with DEBUG_THREADS enabled on OpenBSD
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@216506 f38db490-d61c-443f-a65b-d21fe96a405b
2009-09-04 15:05:05 +00:00
tilghman d1ec1aa57d AST-2009-005
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@211539 f38db490-d61c-443f-a65b-d21fe96a405b
2009-08-10 19:20:57 +00:00
kpfleming 46db1ef34f Ensure that accidental calls to ast_string_field_free_memory() on embedded stringfield pools are safe.
It is possible for a stringfield manager structure (and pool) structure to be allocated
as part of a larger structure allocation (using ast_calloc_with_strinfields()); when
this is done, the stringfield pool cannot be separately freed, but users of the tructure
may not be aware (and shouldn't have to be aware) of whether the pool was embedded.
This patch modifies the behavior so that they can always call ast_string_field_free_memory()
and the function will do the right thing for both embedded and non-embedded situations.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197775 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-28 20:36:49 +00:00
file 167f60f98e Fix a bug in stringfields where it did not actually free the pools of memory.
(closes issue #15074)
Reported by: pj


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@197538 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-28 14:51:43 +00:00
kpfleming 230a66da7d Const-ify the world (or at least a good part of it)
This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes:

- CLI command handlers
- CLI command handler arguments
- AGI command handlers
- AGI command handler arguments
- Dialplan application handler arguments
- Speech engine API function arguments

In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing.

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



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@196072 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-21 21:13:09 +00:00
kpfleming 4437971545 Add a more efficient way of allocating structures that use stringfields
This commit adds an API call that can be used to allocate a structure along with this stringfield storage in a single allocation.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192362 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-05 14:17:18 +00:00
kpfleming 1188fb17fc Correct some flaws in the memory accounting code for stringfields and ao2 objects
Under some conditions, the memory allocation for stringfields and ao2 objects would not have supplied valid file/function names for MALLOC_DEBUG tracking, so this commit corrects that.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192357 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-05 13:18:21 +00:00
kpfleming 23b19461f0 Ensure that string pools allocated to hold stringfields are properly accounted in MALLOC_DEBUG mode
This commit modifies the stringfield pool allocator to remember the 'owner' of the stringfield manager the pool is being allocated for, and ensures that pools allocated in the future when fields are populated are owned by that file/function.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@192279 f38db490-d61c-443f-a65b-d21fe96a405b
2009-05-05 08:51:06 +00:00
tilghman 23d5f93d74 Support HTTP digest authentication for the http manager interface.
(closes issue #10961)
 Reported by: ys
 Patches: 
       digest_auth_r148468_v5.diff uploaded by ys (license 281)
       SVN branch http://svn.digium.com/svn/asterisk/team/group/manager_http_auth
 Tested by: ys, twilson, tilghman
 Review: http://reviewboard.digium.com/r/223/
 Reviewed by: tilghman,russellb,mmichelson


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@190349 f38db490-d61c-443f-a65b-d21fe96a405b
2009-04-23 20:36:35 +00:00
kpfleming 44a7c6c6f0 Optimizations to the stringfields API
This patch provides a number of optimizations to the stringfields API, focused around saving (not wasting) memory whenever possible. Thanks to Mark Michelson for inspiring this work and coming up with the first two optimizations that are represented here:

Changes:

- Cleanup of some code, fix incorrect doxygen comments

- When a field is emptied or replaced with a new allocation, decrease the amount of 'active' space in the pool it was held in; if that pool reaches zero active space, and is not the current pool, then free it as it is no longer in use

- When allocating a pool, try to allocate a size that will fit in a 'standard' malloc() allocation without wasting space

- When allocating space for a field, store the amount of space in the two bytes immediately preceding the field; this eliminates the need to call strlen() on the field when overwriting it, and more importantly it 'remembers' the amount of space the field has available, even if a shorter string has been stored in it since it was allocated

- Don't automatically double the size of each successive pool allocated; it's wasteful

http://reviewboard.digium.com/r/165/



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@185581 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-31 21:29:50 +00:00
russell b48669aa8f Merged revisions 182810 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r182810 | russell | 2009-03-17 21:09:13 -0500 (Tue, 17 Mar 2009) | 44 lines

Fix cases where the internal poll() was not being used when it needed to be.

We have seen a number of problems caused by poll() not working properly on 
Mac OSX.  If you search around, you'll find a number of references to using 
select() instead of poll() to work around these issues.  In Asterisk, we've 
had poll.c which implements poll() using select() internally.  However, we 
were still getting reports of problems.

vadim investigated a bit and realized that at least on his system, even 
though we were compiling in poll.o, the system poll() was still being used.  
So, the primary purpose of this patch is to ensure that we're using the 
internal poll() when we want it to be used.

The changes are:

1) Remove logic for when internal poll should be used from the Makefile.  
   Instead, put it in the configure script.  The logic in the configure 
   script is the same as it was in the Makefile.  Ideally, we would have 
   a functionality test for the problem, but that's not actually possible, 
   since we would have to be able to run an application on the _target_ 
   system to test poll() behavior.

2) Always include poll.o in the build, but it will be empty if AST_POLL_COMPAT
   is not defined.

3) Change uses of poll() throughout the source tree to ast_poll().  I feel 
   that it is good practice to give the API call a new name when we are 
   changing its behavior and not using the system version directly in all cases.
   So, normally, ast_poll() is just redefined to poll().  On systems where 
   AST_POLL_COMPAT is defined, ast_poll() is redefined to ast_internal_poll().

4) Change poll() in main/poll.c to be ast_internal_poll().

It's worth noting that any code that still uses poll() directly will work fine 
(if they worked fine before).  So, for example, out of tree modules that are 
using poll() will not stop working or anything.  However, for modules to work 
properly on Mac OSX, ast_poll() needs to be used.

(closes issue #13404)
Reported by: agalbraith
Tested by: russell, vadim

http://reviewboard.digium.com/r/198/

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@182847 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-18 02:28:55 +00:00
dbailey fba5c1dadd Fixed error where a check for an zero length, terminated string was needed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@177035 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-18 17:24:07 +00:00
dbailey a206b541a2 Need to take into account the \0 terminator of the old string to determine the amount available.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176948 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-18 16:09:12 +00:00
kpfleming 26faefc9a2 Merged revisions 176216 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r176216 | kpfleming | 2009-02-16 15:10:38 -0600 (Mon, 16 Feb 2009) | 3 lines
  
  fix a flaw in the ast_string_field_build() family of API calls; these functions made no attempt to reuse the space already allocated to a field, so every time the field was written it would allocate new space, leading to what appeared to be a memory leak.
........
  r176254 | kpfleming | 2009-02-16 15:41:46 -0600 (Mon, 16 Feb 2009) | 3 lines

  correct a logic error in the last stringfields commit... don't mark additional space as allocated if the string was built using already-allocated space
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@176255 f38db490-d61c-443f-a65b-d21fe96a405b
2009-02-16 21:45:54 +00:00
russell bb53710341 Merged revisions 166297 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r166297 | russell | 2008-12-22 11:22:56 -0600 (Mon, 22 Dec 2008) | 2 lines

Fix up timeout handling in ast_carefulwrite().

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@166317 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-22 17:29:10 +00:00
russell 87c96dd4d0 Introduce ast_careful_fwrite() and use in AMI to prevent partial writes.
This patch introduces a function to do careful writes on a file stream which
will handle timeouts and partial writes.  It is currently used in AMI to
address the issue that has been reported.  However, there are probably a few
other places where this could be used.

(closes issue #13546)
Reported by: srt
Tested by: russell
http://reviewboard.digium.com/r/104/


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@166282 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-22 17:09:36 +00:00
russell 1dd1e40122 Merged revisions 165796 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r165796 | russell | 2008-12-18 15:39:25 -0600 (Thu, 18 Dec 2008) | 11 lines

Make ast_carefulwrite() be more careful.

This patch handles some additional cases that could result in partial writes
to the file description.  This was done to address complaints about partial
writes on AMI.

(issue #13546) (more changes needed to address potential problems in 1.6)
Reported by: srt
Tested by: russell
Review: http://reviewboard.digium.com/r/99/

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@165801 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-18 21:44:47 +00:00
russell c3b1a5da4e Merged revisions 164881 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r164881 | russell | 2008-12-16 15:38:29 -0600 (Tue, 16 Dec 2008) | 9 lines

Fix an issue where DEBUG_THREADS may erroneously report that a thread 
is exiting while holding a lock.

If the last lock attempt was a trylock, and it failed, it will still be in the
list of locks so that it can be reported.

(closes issue #13219)
Reported by: pj

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@164882 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-16 21:39:15 +00:00
file f983328611 Update to work with new ast_str changes.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@164208 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-15 15:21:23 +00:00
tilghman a41b34a63c Merge ast_str_opaque branch (discontinue usage of ast_str internals)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@163991 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-13 08:36:35 +00:00
russell 78f46b1cdb Merged revisions 162413 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r162413 | russell | 2008-12-09 16:17:39 -0600 (Tue, 09 Dec 2008) | 8 lines

Remove the test_for_thread_safety() function completely.

The test is not valid.  Besides, if we actually suspected that recursive
mutexes were not working, we would get a ton of LOG_ERROR messages when
DEBUG_THREADS is turned on.

(inspired by a discussion on the asterisk-dev list)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@162414 f38db490-d61c-443f-a65b-d21fe96a405b
2008-12-09 22:25:06 +00:00
kpfleming 246ce365ae incorporates r159808 from branches/1.4:
------------------------------------------------------------------------
r159808 | kpfleming | 2008-11-29 10:58:29 -0600 (Sat, 29 Nov 2008) | 7 lines

update dev-mode compiler flags to match the ones used by default on Ubuntu Intrepid, so all developers will see the same warnings and errors

since this branch already had some printf format attributes, enable checking for them and tag functions that didn't have them

format attributes in a consistent way


------------------------------------------------------------------------

in addition:

move some format attributes from main/utils.c to the header files they belong in, and fix up references to the relevant functions based on new compiler warnings



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@159818 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-29 17:57:39 +00:00
tilghman 6e814d6644 Starting with a change to ensure that ast_verbose() preserves ABI compatibility
in 1.6.1 (as compared to 1.6.0 and versions of 1.4), this change also
deprecates the use of Asterisk with FreeBSD 4, given the central use of va_copy
in core functions.  va_copy() is C99, anyway, and we already require C99 for
other purposes, so this isn't really a big change anyway.  This change also
simplifies some of the core ast_str_* functions.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@157639 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-19 01:02:45 +00:00
kpfleming cc1b2c100f bring over all the fixes for the warnings found by gcc 4.3.x from the 1.4 branch, and add the ones needed for all the new code here too
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@153616 f38db490-d61c-443f-a65b-d21fe96a405b
2008-11-02 18:52:13 +00:00
kpfleming 62bafd7086 Merged revisions 132872 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r132872 | kpfleming | 2008-07-23 06:52:18 -0500 (Wed, 23 Jul 2008) | 2 lines

minor optimization for stringfields: when a field is being set to a larger value than it currently contains and it happens to be the most recent field allocated from the currentl pool, it is possible to 'grow' it without having to waste the space it is currently using (or potentially even allocate a new pool)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@132964 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-23 16:30:18 +00:00
bbryant 8e222897e6 Janitor patch to change uses of sizeof to ARRAY_LEN
(closes issue #13054)
Reported by: pabelanger
Patches:
      ARRAY_LEN.patch2 uploaded by pabelanger (license 224)
Tested by: seanbright


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@130129 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-11 18:09:35 +00:00
tilghman 17b8ca89d9 Merged revisions 125793 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r125793 | tilghman | 2008-06-27 08:45:03 -0500 (Fri, 27 Jun 2008) | 2 lines

In this debugging function, copy to a buffer instead of using potentially unsafe pointers.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@125794 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-27 13:54:13 +00:00
qwell 975bedef24 Merged revisions 125587 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r125587 | qwell | 2008-06-26 18:03:15 -0500 (Thu, 26 Jun 2008) | 1 line

Make sure to unlock the lock_info lock (huh?).  Possible deadlock?
........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@125589 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-26 23:04:18 +00:00
bbryant 6b2f0f5e72 Add errors that report any locks held by threads when they are being closed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@124064 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-19 19:48:26 +00:00
tilghman e8556a10e2 Expand RQ_INTEGER type out to multiple types, one for each precision
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@121367 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-09 22:51:59 +00:00
russell 869f8f9573 Add lock tracking for rwlocks. Previously, lock.h only had the ability to
hold tracking information for mutexes.  Now, the "core show locks" output
will output information about who is holding a rwlock when a thread is
waiting on it.

(closes issue #11279)
Reported by: ys
Patches:
      trunk_lock_utils.v8.diff uploaded by ys (license 281)


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@120064 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-03 18:26:51 +00:00
russell 7c67640f40 Fix a minor merge issue that caused a function to not get compiled in with
DEBUG_THREADS like it was supposed to


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@119423 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-30 21:51:17 +00:00
tilghman 3db76e85a4 Merged revisions 118953 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118953 | tilghman | 2008-05-29 12:20:16 -0500 (Thu, 29 May 2008) | 3 lines

Add some debugging code that ensures that when we do deadlock avoidance, we
don't lose the information about how a lock was originally acquired.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@118955 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-29 17:35:19 +00:00
mmichelson c0ca2a427b A new feature thanks to the fine folks at Switchvox!
If a deadlock is detected, then the typical lock information will be
printed along with a backtrace of the stack for the offending threads.
Use of this requires compiling with DETECT_DEADLOCKS and having glibc
installed.

Furthermore, issuing the "core show locks" CLI command will print the
normal lock information as well as a backtraces for each lock. This
requires that DEBUG_THREADS is enabled and that glibc is installed.

All the backtrace features may be disabled by running the configure
script with --without-execinfo as an argument



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@118173 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-23 22:35:50 +00:00
russell af1225cb40 Merged revisions 118048 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r118048 | russell | 2008-05-23 07:30:53 -0500 (Fri, 23 May 2008) | 9 lines

Don't declare a function that takes variable arguments as inline, because it's
not valid, and on some compilers, will emit a warning.

http://gcc.gnu.org/onlinedocs/gcc/Inline.html#Inline

(closes issue #12289)
Reported by: francesco_r
Patches by Tilghman, final patch by me

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@118049 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-23 12:37:31 +00:00
rizzo b19d55996c Use casts or intermediate variables to remove a number
of platform/compiler-dependent warnings when handing
struct timeval fields, both reading and printing them.

It is a lost battle to handle the different ways struct timeval
is handled on the various platforms and compilers, so try
to be pragmatic and go through int/long which are universally
supported.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@116557 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-15 10:56:29 +00:00
mmichelson 1345bbfeaf Merged revisions 115735 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115735 | mmichelson | 2008-05-12 12:51:14 -0500 (Mon, 12 May 2008) | 7 lines

If a thread holds no locks, do not print any information on the thread when issuing
a core show locks command. This will help to de-clutter output somewhat.

Russell said it would be fine to place this improvement in the 1.4 branch, so that's
why it's going here too.


........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115737 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-12 17:55:08 +00:00
tilghman 3390bbb3b6 Merged revisions 115017 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r115017 | tilghman | 2008-05-01 13:59:08 -0500 (Thu, 01 May 2008) | 6 lines

'#' is another reserved character for URIs that also needs to be escaped.
(closes issue #10543)
 Reported by: blitzrage
 Patches: 
       20080418__bug10543.diff.txt uploaded by Corydon76 (license 14)

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115018 f38db490-d61c-443f-a65b-d21fe96a405b
2008-05-01 19:00:18 +00:00
murf 96cbd86b57 Hopefully, this will resolve the issues that russellb had with this log_show_lock().
I gathered the code that filled the string, and put it in a different func which
I cryptically call "append_lock_information()".
Now, both log_show_lock(), and handle_show_locks() both call this code to do
the work. Tested, seems to work fine. 
Also, log_show_lock was modified to use the ast_str stuff, along with checking
for successful ast_str creation, and freeing the ast_str obj when finished.
A break was inserted to terminate the search for the lock; we should never
see it twice.

An example usage in chan_sip.c was created as a comment, for instructional
purposes.



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114520 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-22 14:38:46 +00:00
russell a12ad00e36 Make this file compile. The variable str is never set anywhere. Furthermore,
it duplicates a lot of code.  I will leave it to murf to clean up.


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114231 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-17 22:21:32 +00:00
murf c99aa3db82 A small enhancement-- I added the routine log_show_lock to utils.c, which if the mentioned lock has been acquired, this routine will log to the console the normal info about that lock you'd see from the CLI when you do a 'core show locks'. It's solely for debug-- if the lock is NOT acquired, there is no output. I use it to show 'unexpected' locks, to see where/why a lock is pre-locked. This command is to be called from points of interest, like just before a trylock, and helps to spot fleeting, highly temporal locks that normally are not locked...
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114187 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-16 20:54:41 +00:00
mmichelson e8da1cc73c Merged revisions 114051 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r114051 | mmichelson | 2008-04-10 15:59:49 -0500 (Thu, 10 Apr 2008) | 3 lines

Fix 1.4 build when LOW_MEMORY is enabled.


........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@114052 f38db490-d61c-443f-a65b-d21fe96a405b
2008-04-10 22:02:32 +00:00
russell f4fab2eaf1 Merged revisions 109838 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r109838 | russell | 2008-03-18 23:06:05 -0500 (Tue, 18 Mar 2008) | 2 lines

Tweak spacing in a recent change because I'm very picky.

........


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@109839 f38db490-d61c-443f-a65b-d21fe96a405b
2008-03-19 04:06:31 +00:00