[openslp] Launch slpd as a 'notify' daemon with systemd, rather than forking
vcrhonek
vcrhonek at fedoraproject.org
Mon Mar 17 14:11:42 UTC 2014
commit 6bdbfd402fe67fab0c1910215d62b8cec14cf7f9
Author: Vitezslav Crhonek <vcrhonek at redhat.com>
Date: Mon Mar 17 15:11:31 2014 +0100
Launch slpd as a 'notify' daemon with systemd, rather than forking
openslp-2.0.0-notify-systemd-of-start-up.patch | 39 ++++++++++++++++++++++++
openslp.spec | 11 +++++-
slpd.service | 4 +-
3 files changed, 50 insertions(+), 4 deletions(-)
---
diff --git a/openslp-2.0.0-notify-systemd-of-start-up.patch b/openslp-2.0.0-notify-systemd-of-start-up.patch
new file mode 100644
index 0000000..c2d6f93
--- /dev/null
+++ b/openslp-2.0.0-notify-systemd-of-start-up.patch
@@ -0,0 +1,39 @@
+exporting patch:
+# HG changeset patch
+# User Stephen Gallagher <sgallagh at redhat.com>
+# Date 1394805577 14400
+# Fri Mar 14 09:59:37 2014 -0400
+# Node ID ff9067316db43f8e1204c0a7a743574c9f94feb5
+# Parent 598821da69f2f26b1e76447bfecf139a4210ad48
+Notify systemd of start-up completion
+
+diff -r 598821da69f2 -r ff9067316db4 openslp/slpd/Makefile.am
+--- a/openslp/slpd/Makefile.am Sat Jun 08 15:14:45 2013 -0600
++++ b/openslp/slpd/Makefile.am Fri Mar 14 09:59:37 2014 -0400
+@@ -93,5 +93,5 @@
+ slpd_index.h
+
+ #if you're building on Irix, replace .la with .a below
+-slpd_LDADD = ../common/libcommonslpd.la ../libslpattr/libslpattr.la
++slpd_LDADD = ../common/libcommonslpd.la ../libslpattr/libslpattr.la -lsystemd-daemon
+
+diff -r 598821da69f2 -r ff9067316db4 openslp/slpd/slpd_main.c
+--- a/openslp/slpd/slpd_main.c Sat Jun 08 15:14:45 2013 -0600
++++ b/openslp/slpd/slpd_main.c Fri Mar 14 09:59:37 2014 -0400
+@@ -58,6 +58,8 @@
+ #include "slp_xid.h"
+ #include "slp_net.h"
+
++#include <systemd/sd-daemon.h>
++
+ int G_SIGALRM;
+ int G_SIGTERM;
+ int G_SIGHUP;
+@@ -666,6 +668,7 @@
+
+ /* Main loop */
+ SLPDLog("Startup complete entering main run loop ...\n\n");
++ sd_notify(0, "READY=1");
+ G_SIGALRM = 0;
+ G_SIGTERM = 0;
+ G_SIGHUP = 0;
diff --git a/openslp.spec b/openslp.spec
index e4fc25c..a5daf0c 100644
--- a/openslp.spec
+++ b/openslp.spec
@@ -2,7 +2,7 @@
Summary: Open implementation of Service Location Protocol V2
Name: openslp
Version: 2.0.0
-Release: 1%{?dist}
+Release: 2%{?dist}
Group: System Environment/Libraries
License: BSD
@@ -19,12 +19,14 @@ Source4: slpd.service
# Patch1: creates script from upstream init script that sets multicast
# prior to the start of the service
Patch1: openslp-2.0.0-multicast-set.patch
+# Patch2: notify systemd of start-up completion
+Patch2: openslp-2.0.0-notify-systemd-of-start-up.patch
BuildRequires: automake libtool
BuildRequires: bison
BuildRequires: flex
BuildRequires: openssl-devel
-BuildRequires: systemd-units
+BuildRequires: systemd-units systemd-devel
%description
Service Location Protocol is an IETF standards track protocol that
@@ -58,6 +60,7 @@ OpenSLP server daemon to dynamically register services.
%setup -q
%patch1 -p1 -b .multicast-set
+%patch2 -p2 -b .systemd
# tarball goof (?), it wants to re-automake anyway, so let's do it right.
#libtoolize --force
@@ -167,6 +170,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Mon Mar 17 2014 Vitezslav Crhonek <vcrhonek at redhat.com> - 2.0.0-2
+- Launch slpd as a 'notify' daemon with systemd, rather than forking
+ (patch by Stephen Gallagher)
+
* Tue Oct 01 2013 Vitezslav Crhonek <vcrhonek at redhat.com> - 2.0.0-1
- Update to openslp-2.0.0
- Fix bogus dates in %%changelog
diff --git a/slpd.service b/slpd.service
index 1ac7fec..382f6e9 100644
--- a/slpd.service
+++ b/slpd.service
@@ -3,8 +3,8 @@ Description=OpenSLP daemon for the Service Location Protocol
After=network.target
[Service]
-Type=forking
-ExecStart=/usr/sbin/slpd
+Type=notify
+ExecStart=/usr/sbin/slpd -d
ExecStartPre=/usr/lib/openslp-server/slp-multicast-set.sh
[Install]
More information about the scm-commits
mailing list