cedric pushed a commit to branch master.

commit 29299ea2ab2338065514299b0b3f70374e8a79e4
Author: Cedric Bail <[email protected]>
Date:   Sun Mar 10 20:53:58 2013 +0900

    ecore: notify systemd automatically when the main loop is starting.
---
 ChangeLog                  |  1 +
 NEWS                       |  1 +
 configure.ac               | 10 +++++-----
 src/lib/ecore/ecore_main.c |  7 +++++++
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 719dfc9..281ed38 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
        * Eeze: add a dummy implementation of libmount when it is not available.
        * Ecore_Con: add systemd socket activation support 
(ECORE_CON_SOCKET_ACTIVATE).
+       * Ecore: notify systemd that we are ready as soon as the main loop is 
running.
 
 2013-03-08  Igor Murzov
 
diff --git a/NEWS b/NEWS
index 2729d5c..31b17ae 100644
--- a/NEWS
+++ b/NEWS
@@ -73,6 +73,7 @@ Additions:
     * Ecore_x: Add manual render code before deiconify
     * Eeze: Add a dummy libmount replacement for when libmount is not there.
     * Ecore_Con: Add systemd socket activation support 
(ECORE_CON_SOCKET_ACTIVATE).
+    * Ecore: notify systemd that we are ready as soon as the main loop is 
running.
 
 Deprecations:
     * ecore_x:
diff --git a/configure.ac b/configure.ac
index 01ed6e2..6d54280 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,7 @@ case "$host_os" in
    ;;
 esac
 
+want_systemd="no"
 have_wince="no"
 have_win32="no"
 have_windows="no"
@@ -158,6 +159,7 @@ case "$host_os" in
    ;;
    linux*)
       have_linux="yes"
+      want_systemd="yes"
    ;;
 esac
 
@@ -1735,6 +1737,9 @@ if test "x${have_glib}" = "xno"; then
    want_g_main_loop="no"
 fi
 
+EFL_OPTIONAL_DEPEND_PKG([ECORE], [${want_systemd}], [SYSTEMD], 
[libsystemd-daemon])
+
+EFL_ADD_FEATURE([ECORE], [systemd-daemon], [${want_systemd}])
 EFL_ADD_FEATURE([ECORE], [glib])
 EFL_ADD_FEATURE([ECORE], [g-main-loop])
 
@@ -1885,26 +1890,21 @@ want_ecore_con_local_sockets="yes"
 want_ecore_con_abstract_sockets="yes"
 
 if test "${have_wince}" = "yes"; then
-   want_systemd="no"
    want_curl="no"
    want_cares="no"
    want_ecore_con_local_sockets="no"
    want_ecore_con_abstract_sockets="no"
 elif test "${have_win32}" = "yes"; then
-   want_systemd="no"
    want_cares="yes"
    want_ecore_con_abstract_sockets="no"
 elif test "${have_darwin}" = "yes"; then
-   want_systemd="no"
    want_cares="no"
    want_ecore_con_abstract_sockets="no"
 elif test "${have_ps3}" = "yes"; then
-   want_systemd="no"
    want_cares="no"
    want_ecore_con_local_sockets="no"
    want_ecore_con_abstract_sockets="no"
 else
-   want_systemd="yes"
    want_cares="no"
 fi
 
diff --git a/src/lib/ecore/ecore_main.c b/src/lib/ecore/ecore_main.c
index e551ea7..df240c1 100644
--- a/src/lib/ecore/ecore_main.c
+++ b/src/lib/ecore/ecore_main.c
@@ -25,6 +25,10 @@
 #include <fcntl.h>
 #include <sys/time.h>
 
+#ifdef HAVE_SYSTEMD
+# include <systemd/sd-daemon.h>
+#endif
+
 #ifdef _MSC_VER
 # include <float.h>
 #endif
@@ -949,6 +953,9 @@ EAPI void
 ecore_main_loop_begin(void)
 {
    EINA_MAIN_LOOP_CHECK_RETURN;
+#ifdef HAVE_SYSTEMD
+   sd_notify(0, "READY=1");
+#endif
 #ifndef USE_G_MAIN_LOOP
    _ecore_lock();
    in_main_loop++;

-- 

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev

Reply via email to