barbieri pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=564e499467aef67073a2eb9eeccc75bb73e59d99

commit 564e499467aef67073a2eb9eeccc75bb73e59d99
Author: Gustavo Sverzut Barbieri <[email protected]>
Date:   Thu Oct 27 09:30:31 2016 -0200

    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.
---
 src/lib/ecore/Ecore_Common.h | 19 +++++++++++++++++++
 src/lib/ecore/ecore.c        |  9 ++++++++-
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore/Ecore_Common.h b/src/lib/ecore/Ecore_Common.h
index 7b6b377..a95087f 100644
--- a/src/lib/ecore/Ecore_Common.h
+++ b/src/lib/ecore/Ecore_Common.h
@@ -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);
diff --git a/src/lib/ecore/ecore.c b/src/lib/ecore/ecore.c
index 6cca015..07a1304 100644
--- a/src/lib/ecore/ecore.c
+++ b/src/lib/ecore/ecore.c
@@ -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();
 

-- 


Reply via email to