aboutsummaryrefslogtreecommitdiffstats
path: root/main/loader.c
AgeCommit message (Collapse)AuthorFilesLines
2010-02-19Backport crash fix from trunk to 1.4, whereby 'core show gracefully' could ↵tilghman1-17/+30
crash Asterisk. (closes issue #16470) Reported by: kjotte git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@248012 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-09Fix breakage of the "module load <module>" CLI command.russell1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@233879 f38db490-d61c-443f-a65b-d21fe96a405b
2009-12-09Set a module load priority for format modules.russell1-46/+72
A recent change to app_voicemail made it such that the module now assumes that all format modules are available while processing voicemail configuration. However, when autoloading modules, it was possible that app_voicemail was loaded before the format modules. Since format modules don't depend on anything, set a module load priority on them to ensure that they get loaded first when autoloading. This version of the patch is specific to Asterisk 1.4 and 1.6.0. These versions did not already support module load priority in the module API. This adds a trivial version of this which is just a module flag to include it in a pass before loading "everything". Thanks to mmichelson for the review! (closes issue #16412) Reported by: jiddings Tested by: russell Review: https://reviewboard.asterisk.org/r/445/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@233782 f38db490-d61c-443f-a65b-d21fe96a405b
2009-06-04Safely handle AMI connections/reload requests that occur during startup.seanbright1-0/+81
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.4@199022 f38db490-d61c-443f-a65b-d21fe96a405b
2009-03-19Remove the use of RTLD_NOLOAD, as it is not behaving like expected.russell1-13/+0
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@183241 f38db490-d61c-443f-a65b-d21fe96a405b
2008-07-18remove the dlfcn compatibility stuff, because no platforms that Asterisk ↵kpfleming1-4/+0
currently runs on it use it, and it doesn't build anyway git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@131921 f38db490-d61c-443f-a65b-d21fe96a405b
2008-06-12Adds DAHDI support alongside Zaptel. DAHDI usage favored, but all Zap stuff ↵jpeeler1-3/+30
should continue working. Release announcement to follow. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@122314 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-27Use the lock (which already existed, it just wasn't used) on the updaters ↵file1-6/+6
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/branches/1.4@104596 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-15In the case that you try to directly reload a module has returned russell1-2/+10
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/branches/1.4@103728 f38db490-d61c-443f-a65b-d21fe96a405b
2008-02-15Don't attempt to execute the reload callback for a module that returnedrussell1-1/+1
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/branches/1.4@103726 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-06Add a new module flag to indicate that a build sum is present. Modules builtrussell1-2/+4
against older Asterisk 1.4 headers will now load properly with just a warning indicating that they are old and may cause problems. (patch by paravoid) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@91501 f38db490-d61c-443f-a65b-d21fe96a405b
2007-12-06Make sure logger is reloaded at general reload in the cli.oej1-0/+1
(Discovered during Asterisk training in Portugal) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@91366 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-20bring back compile-option checking when loading modules, only this time use ↵kpfleming1-0/+9
a string-based storage and comparison mechanism because it is easier to support on other platforms git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@89461 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-16Temporarily revert revision 89325, which added md5 magic for keeping track ofrussell1-11/+0
what build options were used. We agreed that we should remove this before making a 1.4 release, and then we can put it back in. Then, we can take a month or so to play around with it to get it how we want it. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@89339 f38db490-d61c-443f-a65b-d21fe96a405b
2007-11-16To help combat problems where people build external modules (asterisk-addons ↵kpfleming1-0/+11
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/branches/1.4@89325 f38db490-d61c-443f-a65b-d21fe96a405b
2007-10-22Fixes for building under OpenSolaris.file1-6/+6
(closes issue #11047) Reported by: snuffy Patches: 11047-fixes.diff uploaded by snuffy (license 35) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@86630 f38db490-d61c-443f-a65b-d21fe96a405b
2007-06-05When shutting down "gracefully", go through and run the unload() callbacks forrussell1-0/+25
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/branches/1.4@67308 f38db490-d61c-443f-a65b-d21fe96a405b
2007-05-03improve loader a bit, by avoiding trying to initialize embedded modules ↵kpfleming1-24/+33
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/branches/1.4@62986 f38db490-d61c-443f-a65b-d21fe96a405b
2007-04-20Merged revisions 61704 via svnmerge from qwell1-1/+1
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/branches/1.4@61705 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-22disable unloading of embedded modules... there is a fundamental problem with ↵kpfleming1-0/+5
doing so that will not be fixed in this version of Asterisk due to its invasiveness git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@56006 f38db490-d61c-443f-a65b-d21fe96a405b
2007-02-08Issue 9007 - Mutex not released on early returntilghman1-1/+3
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@53532 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-21Don't use promotion on Darwin because it doesn't seem to work quite right in ↵file1-2/+2
all cases, this should solve the unresolved symbol issue people have been seeing. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@45817 f38db490-d61c-443f-a65b-d21fe96a405b
2006-10-04ensure that local include files are always usedkpfleming1-3/+4
avoid a duplicate function name (term_init()) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@44322 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-15reveting modifaction to __ast_module_user_removeanthonyl1-20/+9
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@42965 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-13Tweak changes that went in on revision 42891file1-4/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@42910 f38db490-d61c-443f-a65b-d21fe96a405b
2006-09-13small fix for 7944anthonyl1-0/+11
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@42891 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-26ensure that unload_dynamic_module won't continue dereferencing a module ↵kpfleming1-3/+8
pointer after the module has been unloaded from memory git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41196 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-25instead of reverting this supposedly 'stupid' change, let's try to get it ↵kpfleming1-0/+9
working properly also eliminate a warning from dlopen() because some flags were missing on the second dlopen() call git-svn-id: http://svn.digium.com/svn/asterisk/trunk@41087 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-24Revert stupid RTLD_NOLOAD change that breaks module loading on some systems.mattf1-9/+0
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40981 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-23use RTLD_NOLOAD if it's available to make loading dynamic modules a little ↵kpfleming1-8/+22
faster and less resource-intensive also, keep trying to dlclose() a module until it actually goes away, since it may have other modules it brought in when it was loaded (thanks PCadach for pointing this problem out to me) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40949 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-22generate a message when a module cannot be found and loadable modules are ↵kpfleming1-0/+1
disabled git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40866 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-22minor improvementskpfleming1-22/+13
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40863 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-22when loadable modules are disabled, if someone tries to load a module that ↵kpfleming1-0/+2
does not exist, don't dereference a NULL pointer, just stop trying to load it... git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40854 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21restore 'preload' functionality in loaderkpfleming1-6/+14
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40796 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21restore printing of module name during loadingkpfleming1-1/+1
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40784 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21use a safer process for checking if a module wants to export symbols into ↵kpfleming1-22/+32
the global namespace git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40769 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21don't declare these variables unless neededkpfleming1-2/+4
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40751 f38db490-d61c-443f-a65b-d21fe96a405b
2006-08-21merge new_loader_completion branch, including (at least):kpfleming1-0/+883
- restructured build tree and makefiles to eliminate recursion problems - support for embedded modules - support for static builds - simpler cross-compilation support - simpler module/loader interface (no exported symbols) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@40722 f38db490-d61c-443f-a65b-d21fe96a405b