systemd 230 version finally deprecated libsystemd-daemon/libsystemd-journal split
and put everything in libsystemd library.
Make sure HAVE_LIBSYSTEMD define is supported in the code (we already
have it defined by the waf).
Patch is based on the code proposed by Zbigniew Jędrzejewski-Szmek
from systemd project.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11936
Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed May 25 20:25:44 CEST 2016 on sn-devel-144
#include "includes.h"
#include "system/filesys.h"
#include "system/locale.h"
#include "includes.h"
#include "system/filesys.h"
#include "system/locale.h"
-#if HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
#include <systemd/sd-daemon.h>
#endif
#include "lib/util/close_low_fd.h"
#include <systemd/sd-daemon.h>
#endif
#include "lib/util/close_low_fd.h"
if (do_fork) {
newpid = fork();
if (newpid) {
if (do_fork) {
newpid = fork();
if (newpid) {
-#if HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
sd_notifyf(0, "READY=0\nSTATUS=Starting process...\nMAINPID=%lu", (unsigned long) newpid);
#endif /* HAVE_LIBSYSTEMD_DAEMON */
_exit(0);
sd_notifyf(0, "READY=0\nSTATUS=Starting process...\nMAINPID=%lu", (unsigned long) newpid);
#endif /* HAVE_LIBSYSTEMD_DAEMON */
_exit(0);
_PUBLIC_ void exit_daemon(const char *msg, int error)
{
_PUBLIC_ void exit_daemon(const char *msg, int error)
{
-#ifdef HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
if (msg == NULL) {
msg = strerror(error);
}
if (msg == NULL) {
msg = strerror(error);
}
if (name == NULL) {
name = "Samba";
}
if (name == NULL) {
name = "Samba";
}
-#ifdef HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
sd_notifyf(0, "READY=1\nSTATUS=%s: ready to serve connections...", name);
#endif
DEBUG(0, ("STATUS=daemon '%s' finished starting up and ready to serve "
sd_notifyf(0, "READY=1\nSTATUS=%s: ready to serve connections...", name);
#endif
DEBUG(0, ("STATUS=daemon '%s' finished starting up and ready to serve "
if (name == NULL) {
name = "Samba";
}
if (name == NULL) {
name = "Samba";
}
-#ifdef HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
sd_notifyf(0, "\nSTATUS=%s: %s", name, msg);
#endif
DEBUG(0, ("STATUS=daemon '%s' : %s", name, msg));
sd_notifyf(0, "\nSTATUS=%s: %s", name, msg);
#endif
DEBUG(0, ("STATUS=daemon '%s' : %s", name, msg));