I have made the following changes intended for :
  CE:MW:Shared / dsme

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/7351

Thank You,
Pekka Lundstrom

[This message was auto-generated]

---

Request # 7351:

Messages from BOSS:

State: review at 2012-11-09T09:35:51 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:plundstr:branches:CE:MW:Shared / dsme -> CE:MW:Shared / dsme
  
changes files:
--------------
--- dsme.changes
+++ dsme.changes
@@ -0,0 +1,6 @@
+* Fri Nov 9 2012 Pekka Lundstrom <[email protected]> - 0.62.6
+- Added systemd feedback to dsme start. Now daemons that need dsme to
+  be started and running don't need to use waitfordsme binary but
+  those can use "After=dsme.service"
+  Fixes NEMO#566 :  waitfordsme should be removed
+

old:
----
  dsme-0.62.5.tar.gz

new:
----
  dsme-0.62.6.tar.gz

spec files:
-----------
--- dsme.spec
+++ dsme.spec
@@ -9,7 +9,7 @@
 # << macros
 
 Summary:    Device State Management Entity
-Version:    0.62.5
+Version:    0.62.6
 Release:    0
 Group:      System/System Control
 License:    LGPLv2+
@@ -27,6 +27,7 @@
 BuildRequires:  pkgconfig(dbus-glib-1)
 BuildRequires:  pkgconfig(libiphb)
 BuildRequires:  pkgconfig(dsme)
+BuildRequires:  pkgconfig(systemd)
 BuildRequires:  python
 BuildRequires:  libcreds2-devel
 
@@ -54,6 +55,7 @@
     --disable-poweron-timer \
     --disable-upstart \
     --enable-runlevel \
+    --enable-systemd \
     --enable-pwrkeymonitor \
     --disable-validatorlistener
 

other changes:
--------------

++++++ dsme-0.62.5.tar.gz -> dsme-0.62.6.tar.gz
--- configure.ac
+++ configure.ac
@@ -1,5 +1,5 @@
 # Package name and version
-AC_INIT(dsme, 0.62.5)
+AC_INIT(dsme, 0.62.6)
 
 AM_INIT_AUTOMAKE
 
@@ -66,6 +66,19 @@
 AM_CONDITIONAL([WANT_UPSTART], [test x$enable_upstart != xno])
 
 #
+# systemd
+#
+AC_ARG_ENABLE([systemd],
+  [AS_HELP_STRING([--enable-systemd],
+    [enable systemd start feedback])],
+  [],
+  [enable_systemd=no])
+
+AS_IF([test "x$enable_systemd" != xno],
+  [AC_DEFINE([DSME_SYSTEMD_ENABLE], [1])])
+AM_CONDITIONAL([WANT_SYSTEMD], [test x$enable_systemd != xno])
+
+#
 # validatorlistener
 #
 AC_ARG_ENABLE([validatorlistener],
--- dsme/Makefile.am
+++ dsme/Makefile.am
@@ -32,6 +32,9 @@
 dsme_CFLAGS = -g -std=c99 -Wall -Wwrite-strings -Wmissing-prototypes -Werror \
               $(C_OPTFLAGS)
 dsme_LDFLAGS = -Wl,--as-needed
+if WANT_SYSTEMD
+dsme_LDADD   = -L/lib -lsystemd-daemon
+endif
 
 #
 # dsme-server
--- dsme/dsme-server.c
+++ dsme/dsme-server.c
@@ -81,6 +81,10 @@
                     "Logging type (syslog, sti, stderr, stdout, none)\n");
   fprintf(stderr, " -v  --verbosity   Log verbosity (3..7)\n");
 #endif
+#ifdef DSME_SYSTEMD_ENABLE
+  fprintf(stderr, " -s  --systemd     "
+                    "Signal systemd when initialization is done\n");
+#endif
   fprintf(stderr, " -h  --help        Help\n");
 }
 
@@ -104,6 +108,9 @@
 static int        logging_verbosity = LOG_INFO;
 static log_method logging_method    = LOG_METHOD_SYSLOG;
 #endif
+#ifdef DSME_SYSTEMD_ENABLE
+static int signal_systemd = 0;
+#endif
 
 static void parse_options(int      argc,           /* in  */
                           char*    argv[],         /* in  */
@@ -111,11 +118,14 @@
 {
   int          next_option;
   const char*  program_name  = argv[0];
-  const char*  short_options = "dhp:l:v:";
+  const char*  short_options = "dhsp:l:v:";
   const struct option long_options[] = {
         { "startup-module", 1, NULL, 'p' },
         { "help",           0, NULL, 'h' },
         { "verbosity",      0, NULL, 'v' },
+#ifdef DSME_SYSTEMD_ENABLE
+        { "systemd",        0, NULL, 's' },
+#endif
 #ifdef DSME_LOG_ENABLE  
         { "logging",        0, NULL, 'l' },
 #endif
@@ -169,6 +179,11 @@
           fprintf(stderr, ME "Logging not compiled in\n");
           break;
 #endif  
+#ifdef DSME_SYSTEMD_ENABLE
+        case 's': /* -s or --systemd */
+          signal_systemd = 1;
+          break;
+#endif
         case 'h': /* -h or --help */
           usage(program_name);
           exit(EXIT_SUCCESS);
@@ -289,7 +304,14 @@
       dsme_log(LOG_CRIT, "chdir failed: %s", strerror(errno));
       return EXIT_FAILURE;
   }
-
+#ifdef DSME_SYSTEMD_ENABLE
+  /* Inform main process that we are ready 
+   * Main process will inform systemd
+   */
+  if (signal_systemd) {
+      kill(getppid(), SIGUSR1);
+  }
+#endif
   dsme_log(LOG_DEBUG, "Entering main loop");
   dsme_main_loop_run(process_message_queue);
   dsme_log(LOG_CRIT, "Exited main loop, quitting");
--- dsme/dsme-wdd.c
+++ dsme/dsme-wdd.c
@@ -44,6 +44,9 @@
 #include <sched.h>
 #include <sys/mman.h>
 #include <sys/wait.h>
+#ifdef DSME_SYSTEMD_ENABLE
+#include <systemd/sd-daemon.h>
+#endif
 
 #define STRINGIFY(x)  STRINGIFY2(x)
 #define STRINGIFY2(x) #x
@@ -174,6 +177,12 @@
         case SIGTERM:
             run = false;
             break;
+#ifdef DSME_SYSTEMD_ENABLE
+        case SIGUSR1:
+            /* Inform systemd that server is initialized */
+            sd_notify(0, "READY=1");
+            break;
+#endif
     }
 }
 
@@ -188,10 +197,13 @@
 {
     int          next_option;
     const char*  program_name  = argv[0];
-    const char*  short_options = "dhp:l:v:";
+    const char*  short_options = "dhsp:l:v:";
     const struct option long_options[] = {
         { "help",           0, NULL, 'h' },
         { "verbosity",      0, NULL, 'v' },
+#ifdef DSME_SYSTEMD_ENABLE
+        { "systemd",        0, NULL, 's' },
+#endif
 #ifdef DSME_LOG_ENABLE  
         { "logging",        0, NULL, 'l' },
 #endif
@@ -354,6 +366,9 @@
     signal(SIGTERM, signal_handler);
     signal(SIGPIPE, signal_handler);
     signal(SIGCHLD, signal_handler);
+#ifdef DSME_SYSTEMD_ENABLE
+    signal(SIGUSR1, signal_handler);
+#endif
 
 
     // protect from oom

++++++ dsme.service
--- dsme.service
+++ dsme.service
@@ -3,9 +3,10 @@
 After=syslog.target
 
 [Service]
+Type=notify
 Environment=DSME_SOCKFILE=/run/dsme.socket
 Environment=BOOTSTATE=USER
-ExecStart=/usr/sbin/dsme -p /usr/lib/dsme/libstartup.so
+ExecStart=/usr/sbin/dsme -p /usr/lib/dsme/libstartup.so --systemd
 Restart=always
 
 [Install]

++++++ dsme.yaml
--- dsme.yaml
+++ dsme.yaml
@@ -1,6 +1,6 @@
 Name: dsme
 Summary: Device State Management Entity
-Version: 0.62.5
+Version: 0.62.6
 Release: 0
 Group: System/System Control
 License: LGPLv2+
@@ -14,6 +14,7 @@
     - "--disable-poweron-timer"
     - "--disable-upstart"
     - "--enable-runlevel"
+    - "--enable-systemd"
     - "--enable-pwrkeymonitor"
     - "--disable-validatorlistener"
 
@@ -29,6 +30,7 @@
     - dbus-glib-1
     - libiphb
     - dsme
+    - systemd
 
 PkgBR:
     - python



Reply via email to