aboutsummaryrefslogtreecommitdiffstats
path: root/main/loader.c
AgeCommit message (Collapse)AuthorFilesLines
2009-06-04Merged revisions 199051 via svnmerge from seanbright1-0/+81
https://origsvn.digium.com/svn/asterisk/trunk ................ r199051 | seanbright | 2009-06-04 10:31:24 -0400 (Thu, 04 Jun 2009) | 47 lines Merged revisions 199022 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r199022 | seanbright | 2009-06-04 10:14:57 -0400 (Thu, 04 Jun 2009) | 40 lines Safely handle AMI connections/reload requests that occur during startup. During asterisk startup, a lock on the list of modules is obtained by the primary thread while each module is initialized. Issue 13778 pointed out a problem with this approach, however. Because the AMI is loaded before other modules, it is possible for a module reload to be issued by a connected client (via Action: Command), causing a deadlock. The resolution for 13778 was to move initialization of the manager to happen after the other modules had already been lodaded. While this fixed this particular issue, it caused a problem for users (like FreePBX) who call AMI scripts via an #exec in a configuration file (See issue 15189). The solution I have come up with is to defer any reload requests that come in until after the server is fully booted. When a call comes in to ast_module_reload (from wherever) before we are fully booted, the request is added to a queue of pending requests. Once we are done booting up, we then execute these deferred requests in turn. Note that I have tried to make this a bit more intelligent in that it will not queue up more than 1 request for the same module to be reloaded, and if a general reload request comes in ('module reload') the queue is flushed and we only issue a single deferred reload for the entire system. As for how this will impact existing installations - Before 13778, a reload issued before module initialization was completed would result in a deadlock. After 13778, you simply couldn't connect to the manager during startup (which causes problems with #exec-that-calls-AMI configuration files). I believe this is a good general purpose solution that won't negatively impact existing installations. (closes issue #15189) (closes issue #13778) Reported by: p_lindheimer Patches: 06032009_15189_deferred_reloads.diff uploaded by seanbright (license 71) Tested by: p_lindheimer, seanbright Review: https://reviewboard.asterisk.org/r/272/ ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@199052 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-19Merged revisions 183242 via svnmerge from russell1-13/+0
https://origsvn.digium.com/svn/asterisk/trunk ................ r183242 | russell | 2009-03-19 13:00:15 -0500 (Thu, 19 Mar 2009) | 10 lines Merged revisions 183241 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r183241 | russell | 2009-03-19 12:52:52 -0500 (Thu, 19 Mar 2009) | 2 lines Remove the use of RTLD_NOLOAD, as it is not behaving like expected. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@183243 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-28Merged revisions 134086 via svnmerge from kpfleming1-26/+2
https://origsvn.digium.com/svn/asterisk/trunk ........ r134086 | kpfleming | 2008-07-28 11:42:00 -0500 (Mon, 28 Jul 2008) | 3 lines remove remaining Zaptel references in various places ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@134087 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-18Merged revisions 131923 via svnmerge from kpfleming1-4/+0
https://origsvn.digium.com/svn/asterisk/trunk ................ r131923 | kpfleming | 2008-07-18 11:16:12 -0500 (Fri, 18 Jul 2008) | 10 lines Merged revisions 131921 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r131921 | kpfleming | 2008-07-18 11:15:41 -0500 (Fri, 18 Jul 2008) | 2 lines remove the dlfcn compatibility stuff, because no platforms that Asterisk currently runs on it use it, and it doesn't build anyway ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@131924 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-17Goodbye Zaptel, hello DAHDI. Removes Zaptel driver support with DAHDI. ↵jpeeler1-3/+30
Configuration file and dialplan backwards compatability has been put in place where appropiate. Release announcement to follow. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@123332 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-05Merged revisions 120602 via svnmerge from tilghman1-2/+3
https://origsvn.digium.com/svn/asterisk/trunk ........ r120602 | tilghman | 2008-06-05 10:58:11 -0500 (Thu, 05 Jun 2008) | 4 lines Conditionally load the AGI command gosub, depending on whether or not res_agi has been loaded, fix a return value in the loader, and ensure that the help workhorse header does not print on load. ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@120603 f38db490-d61c-443f-a65b-d21fe96a405b
2008-03-12Merged revisions 107960 via svnmerge from tilghman1-2/+2
https://origsvn.digium.com/svn/asterisk/trunk ........ r107960 | tilghman | 2008-03-12 00:46:39 -0500 (Wed, 12 Mar 2008) | 4 lines Revert several changes from revision 102525, as the changes were not compatible, and, in fact, introduced regressions. (Closes issue #12190) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@107961 f38db490-d61c-443f-a65b-d21fe96a405b
2008-03-06Merged revisions 105840 via svnmerge from russell1-5/+5
https://origsvn.digium.com/svn/asterisk/trunk ........ r105840 | tilghman | 2008-03-04 17:04:29 -0600 (Tue, 04 Mar 2008) | 2 lines Whitespace changes only ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@106306 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-27Merged revisions 104596 via svnmerge from file1-6/+6
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r104596 | file | 2008-02-27 13:07:33 -0400 (Wed, 27 Feb 2008) | 4 lines Use the lock (which already existed, it just wasn't used) on the updaters list to protect the contents instead of the overall module list lock. (closes issue #12080) Reported by: ChaseVenters ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@104597 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-19Add a log message that appears when you try to unload a module that isn't ↵file1-0/+1
loaded. (closes issue #12033) Reported by: jamesgolovich Patches: asterisk-loader.diff.txt uploaded by jamesgolovich (license 176) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@103828 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-15Merged revisions 103728 via svnmerge from russell1-2/+10
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r103728 | russell | 2008-02-15 13:50:11 -0600 (Fri, 15 Feb 2008) | 4 lines In the case that you try to directly reload a module has returned AST_MODULE_LOAD_DECLINE, log a message indicating that the module is not fully initialized and must be initialized using "module load". ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@103729 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-15Merged revisions 103726 via svnmerge from russell1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r103726 | russell | 2008-02-15 12:33:29 -0600 (Fri, 15 Feb 2008) | 6 lines Don't attempt to execute the reload callback for a module that returned AST_MODULE_LOAD_DECLINE. This fixes a crash that was reported against chan_console in trunk. (closes issue #11953, reported by junky, fixed by me) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@103727 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-05Get rid of any remaining ast_verbose calls in the code in favor of mmichelson1-2/+2
ast_verb (closes issue #11934) Reported by: mvanbaak Patches: 20080205_astverb-2.diff.txt uploaded by mvanbaak (license 7) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@102525 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-23Move code from res_features into (new file) main/features.cqwell1-0/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@100039 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-07Move ModuleLoad and ModuleCheck manager commands from loader.c to manager.c. ↵file1-107/+2
Previously they would get registered twice because of the way manager.c operates. (closes issue #11699) Reported by: caio1982 Patches: manager_module_commands1.diff uploaded by caio1982 (license 22) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@96858 f38db490-d61c-443f-a65b-d21fe96a405b
2008-01-02some cleanup of this code while I am trying to debug a problem withrizzo1-15/+19
gdb dying while debugging asterisk. The problem seems to be related with a race in the handling of module_list, which in turn is triggeded by calling dlopen() on a system which uses initializers to create locks. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@95772 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-06Merged revisions 91366 via svnmerge from oej1-0/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r91366 | oej | 2007-12-06 13:54:11 +0100 (Tor, 06 Dec 2007) | 4 lines Make sure logger is reloaded at general reload in the cli. (Discovered during Asterisk training in Portugal) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@91384 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-27More "moremanager" fixes. Manager commands to check module status.oej1-0/+112
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89771 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-21remove a bunch of useless #include "options.h"rizzo1-1/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89511 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-20move asterisk/paths.h outside asterisk.h and into those filesrizzo1-0/+1
who really need it. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89466 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-20move internal function declarations to include/asterisk/_private.hrizzo1-0/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89465 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-20switch compile-time option checking to string storage mode in this branch tookpfleming1-5/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89463 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-19another bunch of include removals (errno.h and asterisk/logger.h)rizzo1-2/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89425 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-17define RTLD_LOCAL for platforms that don't have it.rizzo1-0/+4
This is only to complete the build, clearly the linker behaviour will be completely different and likely to cause trouble in those cases. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89367 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-16Start untangling header inclusion in a way that does not affectrizzo1-4/+0
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: http://svn.digium.com/svn/asterisk/trunk@89333 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-16Merged revisions 89325 via svnmerge from kpfleming1-0/+11
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89325 | kpfleming | 2007-11-16 10:47:46 -0600 (Fri, 16 Nov 2007) | 4 lines To help combat problems where people build external modules (asterisk-addons or others) and then change the build options of the Asterisk build in a way that makes the incompatible without warning, this commit introduces an MD5 signature of the important build-time options and includes that signature into modules when they are built. When the loader loads one of these modules and notices the problem, it will emit a warning to console and refuse to initialize the module, as doing so could cause the system to be unstable or even crash. If you upgrade to this version of Asterisk, you must rebuild *all* of your modules that came from other sources before trying to run this version. If you are using Digium's G.729 binary codec module, you will need v33 or newer. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89326 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-08improve linked-list macros in two ways:kpfleming1-5/+5
- the *_CURRENT macros no longer need the list head pointer argument - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89106 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-07remove a debugging message which i forgot in.rizzo1-5/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89083 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-06Fix embedding of modules on FreeBSD:rizzo1-11/+30
the constructor for the list of modules was run after the constructors for the embedded modules (which appended entries to the list). As a result, the list appeared empty when it was time to use it. On linux the order of execution of constructor was evidently different (it may depend on the ordering of modules in the ELF file). This is only a workaround - there may be other situations where the execution of constructors causes problems, so if we manage to find a more general solution this workaround can go away. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89031 f38db490-d61c-443f-a65b-d21fe96a405b
2007-10-22merging patches that don't compile is bad... mmkay?kpfleming1-3/+3
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@86695 f38db490-d61c-443f-a65b-d21fe96a405b
2007-10-22Merged revisions 86630 via svnmerge from file1-9/+9
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r86630 | file | 2007-10-22 10:33:23 -0300 (Mon, 22 Oct 2007) | 6 lines Fixes for building under OpenSolaris. (closes issue #11047) Reported by: snuffy Patches: 11047-fixes.diff uploaded by snuffy (license 35) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@86631 f38db490-d61c-443f-a65b-d21fe96a405b
2007-08-16Don't reload a configuration file if nothing has changed.tilghman1-1/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@79747 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-26Do a massive conversion for using the ast_verb() macrorussell1-8/+4
(closes issue #10277, patches by mvanbaak) Basically, this changes ... if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3, "Something\n"); to ... ast_verb(3, "Something\n"); git-svn-id: http://svn.digium.com/svn/asterisk/trunk@77299 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-19After some study, thought, comparing, etc. I've backed out the previous ↵murf1-2/+2
universal mod to make ast_flags a 64 bit thing. Instead, I added a 64-bit version of ast_flags (ast_flags64), and 64-bit versions of the test-flag, set-flag, etc. macros, and an app_parse_options64 routine, and I use these in app_dial alone, to eliminate the 30-option limit it had grown to meet. There is room now for 32 more options and flags. I was heavily tempted to implement some of the other ideas that were presented, but this solution does not intro any new versions of dial, doesn't have a different API, has a minimal/zero impact on code outside of dial, and doesn't seriously (I hope) affect the code structure of dial. It's the best I can think of right now. My goal was NOT to rewrite dial. I leave that to a future, coordinated effort. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75983 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-18Merge in ast_strftime branch, which changes timestamps to be accurate to the ↵tilghman1-1/+1
microsecond, instead of only to the second git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75706 f38db490-d61c-443f-a65b-d21fe96a405b
2007-07-17via 10206, I have added an option (e) to Dial to allow the h exten to get ↵murf1-2/+2
run on peer. Had to upgrade ast_flag stuff to 64 bits to do this. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75400 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-24Conversions to ast_debug()russell1-2/+1
(issue #9984, patches from eliel and dimas) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@71338 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-14Convert uses of strdup() to ast_strdup()russell1-2/+2
(issue #9983, eliel) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@69436 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-06Issue 9869 - replace malloc and memset with ast_calloc, and other coding ↵tilghman1-14/+14
guidelines changes git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67864 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-05Merged revisions 67308 via svnmerge from russell1-0/+25
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r67308 | russell | 2007-06-05 10:51:53 -0500 (Tue, 05 Jun 2007) | 5 lines When shutting down "gracefully", go through and run the unload() callbacks for all of the modules. "stop now" is considered a non-graceful shutdown and will not go through this process. (issue #9804, reported by chrisost, patch by me) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@67310 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-07Constificationsoej1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@63240 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-03Merged revisions 62986 via svnmerge from kpfleming1-24/+33
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r62986 | kpfleming | 2007-05-03 11:38:56 -0500 (Thu, 03 May 2007) | 2 lines improve loader a bit, by avoiding trying to initialize embedded modules twice and avoiding trying to load modules from disk when they have been loaded already during the 'preload' pass (reported by blitzrage on IRC, patch by me) ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@62988 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-20Merged revisions 61705 via svnmerge from qwell1-1/+1
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r61705 | qwell | 2007-04-20 16:15:29 -0500 (Fri, 20 Apr 2007) | 12 lines Merged revisions 61704 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r61704 | qwell | 2007-04-20 16:14:27 -0500 (Fri, 20 Apr 2007) | 4 lines Fix an issue that I noticed while looking over issue 9571. The reload timestamp was getting set after reloading the built-in stuff, and before the modules. ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@61706 f38db490-d61c-443f-a65b-d21fe96a405b
2007-03-19It is possible for mod to become invalid after we unload it (if it's a ↵file1-3/+3
dynamic module) so move it around a bit. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@59051 f38db490-d61c-443f-a65b-d21fe96a405b
2007-03-07Make the loader less noisy under valgrind.file1-2/+2
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@58286 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-22give embedded modules a helping hand by backing up and restoring their ↵kpfleming1-0/+8
global variables when they are loaded and unloaded git-svn-id: http://svn.digium.com/svn/asterisk/trunk@56092 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-08Merged revisions 53532 via svnmerge from tilghman1-1/+3
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r53532 | tilghman | 2007-02-08 07:47:54 -0600 (Thu, 08 Feb 2007) | 2 lines Issue 9007 - Mutex not released on early return ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@53533 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-31Take two, using find_resource on Kevin's suggestion. oej1-10/+4
Might need better locking support, giving up if we can't get the lock. Right now, using existing locking in find_resource git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46582 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-30Adding dialplan function IFMODULE, so you can create dialplans that handleoej1-0/+20
various PBX installations and checks if a module is loaded before using it. example IFMODULE(chan_sip3.so) issue #6671 in the bug tracker, finally gone. Thanks to mithraen for keeping it updated. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46513 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-21Merged revisions 45817 via svnmerge from file1-2/+2
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r45817 | file | 2006-10-21 14:48:58 -0400 (Sat, 21 Oct 2006) | 2 lines Don't use promotion on Darwin because it doesn't seem to work quite right in all cases, this should solve the unresolved symbol issue people have been seeing. ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@45820 f38db490-d61c-443f-a65b-d21fe96a405b