Launch slpd as a 'notify' daemon with systemd, rather than forking

This commit is contained in:
Vitezslav Crhonek 2014-03-17 15:11:31 +01:00
parent e62c923b2d
commit 6bdbfd402f
3 changed files with 50 additions and 4 deletions

View File

@ -0,0 +1,39 @@
exporting patch:
# HG changeset patch
# User Stephen Gallagher <sgallagh@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;

View File

@ -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@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@redhat.com> - 2.0.0-1
- Update to openslp-2.0.0
- Fix bogus dates in %%changelog

View File

@ -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]