summaryrefslogtreecommitdiff
path: root/common/Jackdmp.cpp
diff options
context:
space:
mode:
authorTimo Wischer <twischer@de.adit-jv.com>2018-02-28 11:38:56 +0100
committerFilipe Coelho <falktx@falktx.com>2018-08-08 21:03:49 +0200
commit9fe6486c6e289c24d4d7d264ef49ff3fa64eeb7d (patch)
tree3a327e64a3afb69bcf4e385c58cbdc3c047e87eb /common/Jackdmp.cpp
parent67e4b4368e73616a6e0aa020925ead75cd57221e (diff)
downloadjack2-9fe6486c6e289c24d4d7d264ef49ff3fa64eeb7d.tar.gz
jackdmp: Signal to systemd when ready
With this patch it is possibly to start the JACK daemon with a systemd service file of type notify. The following provides an example service file: [Service] Type=notify ExecStart=/usr/bin/jackd -d alsa [Install] WantedBy=multi-user.target Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
Diffstat (limited to 'common/Jackdmp.cpp')
-rw-r--r--common/Jackdmp.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/Jackdmp.cpp b/common/Jackdmp.cpp
index 3d634346..e7198f4d 100644
--- a/common/Jackdmp.cpp
+++ b/common/Jackdmp.cpp
@@ -43,6 +43,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "audio_reserve.h"
#endif
+#if HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
+
/*
This is a simple port of the old jackdmp.cpp file to use the new jack2 control API. Available options for the server
are "hard-coded" in the source. A much better approach would be to use the control API to:
@@ -624,6 +628,10 @@ int main(int argc, char** argv)
notify_sent = true;
return_value = 0;
+#if HAVE_SYSTEMD
+ sd_notify(0, "READY=1");
+#endif
+
// Waits for signal
#ifdef __ANDROID__
//reserve SIGUSR2 signal for switching master driver
@@ -639,6 +647,10 @@ int main(int argc, char** argv)
jackctl_wait_signals(sigmask);
#endif
+#if HAVE_SYSTEMD
+ sd_notify(0, "STOPPING=1");
+#endif
+
stop_server:
if (!jackctl_server_stop(server_ctl)) {
fprintf(stderr, "Cannot stop server...\n");