Summary:ASTERISK-05376: [patch] [post 1.2] sub-architechture-specific directory for modules
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2005-10-27 05:06:29Date Closed:2011-06-07 14:02:51
Versions:Frequency of
Environment:Attachments:( 0) module_optim_dir.dpatch
( 1) modules_extradir.diff.txt
Description:With the following patch asterisk (when the parameter optim_dir is set in modules.conf) will first look for modules in /usr/lib/asterisk/<optim_dir> before looking for them in /usr/lib/modules/asterisk/ .

This should allow e.g. binary distribution of optimized codecs code for various CPU optimizations.

Impact in case the parameter is not used should be very small.


1. Tested to apply with current CVS HEAD and to build with beta1

2. If code is not used (parameter is not given), the impact of this patch is an extra call to ast_variable_retrieve for each module load.

3. In any case, if a module's load from <optim_dir> has failed, there should be no attempt made to load it from the original path. There is still just one call to dlopen.

4. The patch currently has no impact on the case a a full path to the module is given. That would involve a more complicated code, and probably replicate code from the loading of the sound file in file.c.
Comments:By: Olle Johansson (oej) 2005-10-30 03:21:21.000-0600

optim dir is not a good name, it doesn't have to be optimized modules. alt_dir or extra_dir or something more generic would be preferred.

By: Tzafrir Cohen (tzafrir) 2005-12-05 15:06:26.000-0600

using the name "extradir" now (it seems an underscore can't be used in a config parameter name). Also note that overhead is more that I thought: config check per module.

If this patch is applied, there is probably no use in making an ealier separate conditional load of the configuration.

By: Matt O'Gorman (mogorman) 2006-01-12 23:58:37.000-0600

yay or nay marko, code is fine.

By: Mark Spencer (markster) 2006-01-13 06:40:09.000-0600

What about having us look in /usr/lib/asterisk/modules as normal and search for the module name followed by .<arch>.so first, followed by just .so and only load modules that either have no arch, or have arch == our arch, with a preference for those which have our arch.

By: Tzafrir Cohen (tzafrir) 2006-01-13 13:29:42.000-0600

any atvantage for using .arch.so rather than a subdirectory?

1. this requires a rename of the base file name
2. interacts badly with automatic module loading: you have duplicate .so file in the modules directory. Thus unsetting the configuration makes asterisk fail to load.

By: Tilghman Lesher (tilghman) 2006-04-11 17:57:35

I suspect Mark's intent was to prevent the autoloader from loading modules with the suffix of .<arch>.so, unless the arch matches and to automatically select between either the right arch or the common non-optimized module, if an arch is not available for a particular module name.

Another possibility might be to have architecture-specific subdirectories of /usr/lib/asterisk/modules and let the loader scan the correct arch first, eliminating duplicates that way.

By: Serge Vecher (serge-v) 2006-05-04 11:09:41

seems like this needs a revisit after recent loader changes...

By: Serge Vecher (serge-v) 2006-06-06 16:29:01


By: jmls (jmls) 2006-10-31 03:55:47.000-0600


tzafrir: any comments ?

By: Olle Johansson (oej) 2006-10-31 04:21:34.000-0600

reporter has lost interest. (Dicussed with tzafrir on IRC).

By: Denis Smirnov (mithraen) 2006-10-31 04:27:21.000-0600

How I can help with this patch?
I need it, and some users asks for it.

By: Serge Vecher (serge-v) 2006-11-02 15:37:38.000-0600

Mithraen: can you please bring the patch up to date and have some users post some functional test results?

By: Tilghman Lesher (tilghman) 2006-11-30 02:05:02.000-0600

No response -- please feel free to reopen when you have new code to upload.