public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Janani Venkataraman <jananive@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: amwang@redhat.com, procps@freelists.org, rdunlap@xenotime.net,
	james.hogan@imgtec.com, aravinda@linux.vnet.ibm.com, hch@lst.de,
	mhiramat@redhat.com, jeremy.fitzhardinge@citrix.com,
	xemul@parallels.com, d.hatayama@jp.fujitsu.com,
	coreutils@gnu.org, kosaki.motohiro@jp.fujitsu.com,
	adobriyan@gmail.com, util-linux@vger.kernel.org,
	tarundsk@linux.vnet.ibm.com, vapier@gentoo.org,
	roland@hack.frob.com, ananth@linux.vnet.ibm.com,
	gorcunov@openvz.org, avagin@openvz.org, oleg@redhat.com,
	eparis@redhat.com, suzuki@linux.vnet.ibm.com,
	andi@firstfloor.org, tj@kernel.org, akpm@linux-foundation.org,
	torvalds@linux-foundation.org
Subject: [PATCH 32/33] Socket and Service files.
Date: Thu, 20 Mar 2014 15:13:55 +0530	[thread overview]
Message-ID: <20140320094355.14878.93423.stgit@localhost.localdomain> (raw)
In-Reply-To: <20140320093040.14878.903.stgit@localhost.localdomain>

The socket and service files for systemd are created.

Signed-off-by: Janani Venkataraman <jananive@linux.vnet.ibm.com>
---
 Makefile.am      |   15 +++++++++++++++
 configure.ac     |    1 +
 gencore.service  |    9 +++++++++
 gencore.socket   |   10 ++++++++++
 gencore.spec.in  |   21 +++++++++++++++++++++
 gencore@.service |    9 +++++++++
 6 files changed, 65 insertions(+)
 create mode 100644 gencore.service
 create mode 100644 gencore.socket
 create mode 100644 gencore@.service

diff --git a/Makefile.am b/Makefile.am
index 30e86f5..4c6c269 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,5 +3,20 @@ SUBDIRS = src doc
 
 EXTRA_DIST = src/coredump.h src/elf.c src/elf-compat.h doc/gencore.1 doc/gencore.3 Changelog COPYING.LIBGENCORE
 
+if HAVE_SYSTEMD_SOCKET_SUPPORT 
+EXTRA_DIST += gencore.socket gencore@.service
+else
+EXTRA_DIST += gencore.service
+endif
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgencore.pc
+
+systemddir = /usr/lib/systemd
+systemdir = /usr/lib/systemd/system
+
+if HAVE_SYSTEMD_SOCKET_SUPPORT
+system_DATA = gencore@.service gencore.socket
+else
+system_DATA = gencore.service
+endif
diff --git a/configure.ac b/configure.ac
index 6245ae1..39d7902 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,4 +4,5 @@ AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AC_CONFIG_HEADERS([config.h])
 AC_PROG_CC
 AC_CONFIG_FILES(Makefile gencore.spec libgencore.pc)
+AM_CONDITIONAL(HAVE_SYSTEMD_SOCKET_SUPPORT, test "have_systemd_socket_support" = false)
 AC_OUTPUT(src/Makefile doc/Makefile)
diff --git a/gencore.service b/gencore.service
new file mode 100644
index 0000000..79220ff
--- /dev/null
+++ b/gencore.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Gencore service
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/gencore --daemon
+
+[Install]
+WantedBy=multi-user.target
diff --git a/gencore.socket b/gencore.socket
new file mode 100644
index 0000000..b9afce8
--- /dev/null
+++ b/gencore.socket
@@ -0,0 +1,10 @@
+[Unit]
+Description=Gencore socket
+
+[Socket]
+ListenStream=/var/run/gencored.socket
+Accept=true
+
+[Install]
+WantedBy=socket.target
+
diff --git a/gencore.spec.in b/gencore.spec.in
index 58c699e..3937edb 100644
--- a/gencore.spec.in
+++ b/gencore.spec.in
@@ -1,3 +1,5 @@
+%define HAVE_SYSTEMD_SOCKET_SUPPORT 0
+
 Name: gencore
 Version: @VERSION@
 Release: 0
@@ -39,10 +41,19 @@ make
 %install
 make DESTDIR=$RPM_BUILD_ROOT install
 
+%preun
+systemctl stop gencore.service
+
 %files
 %doc README COPYING Changelog
 %{_bindir}/gencore
 %{_mandir}/man1/gencore.1*
+%if %HAVE_SYSTEMD_SOCKET_SUPPORT
+%{_unitdir}/gencore@.service
+%{_unitdir}/gencore.socket
+%else
+%{_unitdir}/gencore.service
+%endif
 
 %files -n libgencore
 %doc COPYING.LIBGENCORE
@@ -56,6 +67,16 @@ make DESTDIR=$RPM_BUILD_ROOT install
 %{_libdir}/libgencore.la
 %{_libdir}/pkgconfig/libgencore.pc
 
+%post
+systemctl --system daemon-reload
+%if %HAVE_SYSTEMD_SOCKET_SUPPORT
+systemctl enable gencore.socket
+systemctl start gencore.socket 
+%else
+systemctl enable gencore.service
+systemctl start gencore.service 
+%endif
+
 %post -n libgencore
 ldconfig -n %{_libdir}/libgencore.so.*
 
diff --git a/gencore@.service b/gencore@.service
new file mode 100644
index 0000000..4dcfb1c
--- /dev/null
+++ b/gencore@.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Gencore service
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/gencore --socket
+
+[Install]
+WantedBy=multi-user.target


  parent reply	other threads:[~2014-03-20  9:44 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-20  9:39 [PATCH 00/33] [RFC] Non disruptive application core dump infrastructure Janani Venkataraman
2014-03-20  9:39 ` [PATCH 01/33] Configure and Make files Janani Venkataraman
2014-03-20  9:39 ` [PATCH 02/33] Validity of arguments Janani Venkataraman
2014-03-20  9:39 ` [PATCH 03/33] Process Status Janani Venkataraman
2014-03-20  9:39 ` [PATCH 04/33] Hold threads Janani Venkataraman
2014-03-20 19:01   ` Pavel Emelyanov
2014-03-25  6:58     ` Janani Venkataraman
2014-03-20  9:39 ` [PATCH 05/33] Fetching Memory maps Janani Venkataraman
2014-03-20  9:39 ` [PATCH 06/33] Check ELF class Janani Venkataraman
2014-03-20  9:39 ` [PATCH 07/33] Do elf_coredump Janani Venkataraman
2014-03-20  9:40 ` [PATCH 08/33] Fills elf header Janani Venkataraman
2014-03-20  9:40 ` [PATCH 09/33] Adding notes infrastructure Janani Venkataraman
2014-03-20  9:40 ` [PATCH 10/33] Populates PRPS info Janani Venkataraman
2014-03-20  9:40 ` [PATCH 11/33] Populate AUXV Janani Venkataraman
2014-03-20  9:40 ` [PATCH 12/33] Fetch File maps Janani Venkataraman
2014-03-20  9:41 ` [PATCH 13/33] Fetching thread specific Notes Janani Venkataraman
2014-03-20  9:41 ` [PATCH 14/33] Populating Program Headers Janani Venkataraman
2014-03-20  9:41 ` [PATCH 15/33] Updating Offset Janani Venkataraman
2014-03-20  9:41 ` [PATCH 16/33] Writing to core file Janani Venkataraman
2014-03-20  9:41 ` [PATCH 17/33] Daemonizing the Process Janani Venkataraman
2014-03-20  9:41 ` [PATCH 18/33] Socket operations Janani Venkataraman
2014-03-20  9:41 ` [PATCH 19/33] Block till request Janani Venkataraman
2014-03-20  9:41 ` [PATCH 20/33] Handling Requests Janani Venkataraman
2014-03-20  9:41 ` [PATCH 21/33] Get Clients PID Janani Venkataraman
2014-03-20  9:41 ` [PATCH 22/33] Dump the task Janani Venkataraman
2014-03-20  9:42 ` [PATCH 23/33] Handling SIG TERM of the daemon Janani Venkataraman
2014-03-20  9:42 ` [PATCH 24/33] Handling SIG TERM of the child Janani Venkataraman
2014-03-20  9:42 ` [PATCH 25/33] Systemd Socket ID retrieval Janani Venkataraman
2014-03-20  9:42 ` [PATCH 26/33] [libgencore] Setting up Connection Janani Venkataraman
2014-03-20  9:42 ` [PATCH 27/33] [libgencore] Request for dump Janani Venkataraman
2014-03-20  9:43 ` [PATCH 28/33] Man pages Janani Venkataraman
2014-03-20  9:43 ` [PATCH 29/33] Automake files for the doc folder Janani Venkataraman
2014-03-20  9:43 ` [PATCH 30/33] README, COPYING, Changelog Janani Venkataraman
2014-03-20  9:43 ` [PATCH 31/33] Spec file Janani Venkataraman
2014-03-20  9:43 ` Janani Venkataraman [this message]
2014-03-20  9:44 ` [PATCH 33/33] Support check Janani Venkataraman
2014-03-20 10:24 ` [PATCH 00/33] [RFC] Non disruptive application core dump infrastructure Pádraig Brady
2014-03-21  8:17 ` Karel Zak
2014-03-21 15:02   ` Phillip Susi
2014-03-24  9:43     ` Janani Venkataraman
2014-03-24 13:54       ` Phillip Susi
2014-07-03 12:59         ` Suzuki K. Poulose
2014-03-24  9:38   ` Janani Venkataraman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140320094355.14878.93423.stgit@localhost.localdomain \
    --to=jananive@linux.vnet.ibm.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=amwang@redhat.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=andi@firstfloor.org \
    --cc=aravinda@linux.vnet.ibm.com \
    --cc=avagin@openvz.org \
    --cc=coreutils@gnu.org \
    --cc=d.hatayama@jp.fujitsu.com \
    --cc=eparis@redhat.com \
    --cc=gorcunov@openvz.org \
    --cc=hch@lst.de \
    --cc=james.hogan@imgtec.com \
    --cc=jeremy.fitzhardinge@citrix.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --cc=oleg@redhat.com \
    --cc=procps@freelists.org \
    --cc=rdunlap@xenotime.net \
    --cc=roland@hack.frob.com \
    --cc=suzuki@linux.vnet.ibm.com \
    --cc=tarundsk@linux.vnet.ibm.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=util-linux@vger.kernel.org \
    --cc=vapier@gentoo.org \
    --cc=xemul@parallels.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox