ecore_init() use getenv(ECORE_NO_SYSTEM_MODULES) and disable those.

Sometimes during debug of efl_net we get some "extra" sockets from
DBus to talk to upower, localed, timedated... which are helpful in
real life, but pollutes debugging.

Since I don't want to contaminate examples with
ecore_app_no_system_modules(), which could lead users to naively copy
those and end without the system modules features, add an envvar that
I can define in my tests when I need them.
This commit is contained in:
Gustavo Sverzut Barbieri 2016-10-27 09:30:31 -02:00
parent d896e3efc5
commit 564e499467
2 changed files with 27 additions and 1 deletions

View File

@ -34,6 +34,22 @@ extern "C" {
* ecore_shutdown();
* }
* @endcode
*
* This function is affected by some environment variables:
*
* @li @c ECORE_NO_SYSTEM_MODULES=1 may be used to temporarily
* disable system modules, often useful for debug.
*
* @li @c ECORE_FPS_DEBUG=1 prints frames per second, usefult to
* detect lags and blocking calls.
*
* @li @c ECORE_MEM_STAT=1 will generate @c ecore_mem_stat.${PID}
* file with memory statistics.
*
* @li @c ECORE_ERROR_ABORT=1 will abort on errors.
*
* This function will call eina_init(), so other environment variables
* may apply.
*/
EAPI int ecore_init(void);
@ -2499,6 +2515,9 @@ EAPI void ecore_app_restart(void);
* This may be useful to some command-line utilities, hardly will be
* useful for end-user applications.
*
* The environment variable ECORE_NO_SYSTEM_MODULES=1 may be used
* to temporarily disable system modules, often useful for debug.
*
* @since 1.8
*/
EAPI void ecore_app_no_system_modules(void);

View File

@ -57,7 +57,7 @@ static FILE *_ecore_memory_statistic_file = NULL;
#endif
#endif
static Eina_Bool _no_system_modules = EINA_FALSE;
static Eina_Bool _no_system_modules = 0xff;
static const char *_ecore_magic_string_get(Ecore_Magic m);
static int _ecore_init_count = 0;
@ -308,6 +308,13 @@ ecore_init(void)
}
#endif
if (_no_system_modules == 0xff)
{
const char *s = getenv("ECORE_NO_SYSTEM_MODULES");
if (s) _no_system_modules = atoi(s);
else _no_system_modules = EINA_FALSE;
}
if (!_no_system_modules)
ecore_system_modules_load();