#include <fstrm.h>
#endif
+#ifdef HAVE_LIBSYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
+
#include <isc/aes.h>
#include <isc/attributes.h>
#include <isc/base64.h>
} while (0)
#define CHECKFATAL(op, msg) \
- do { \
+ { \
result = (op); \
- if (result != ISC_R_SUCCESS) \
+ if (result != ISC_R_SUCCESS) { \
fatal(server, msg, result); \
- } while (0)
+ } \
+ }
/*%
* Maximum ADB size for views that share a cache. Use this limit to suppress
"FIPS mode is %s",
FIPS_mode() ? "enabled" : "disabled");
#endif /* ifdef HAVE_FIPS_MODE */
+
+#if HAVE_LIBSYSTEMD
+ sd_notifyf(0,
+ "READY=1\n"
+ "STATUS=running\n"
+ "MAINPID=%" PRId64 "\n",
+ (int64_t)getpid());
+#endif /* HAVE_LIBSYSTEMD */
+
atomic_store(&server->reload_status, NAMED_RELOAD_DONE);
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
isc_event_free(&event);
+#if HAVE_LIBSYSTEMD
+ sd_notify(0, "STOPPING=1\n");
+#endif /* HAVE_LIBSYSTEMD */
+
/*
* We need to shutdown the interface before going
* exclusive (which would pause the netmgr).
isc_result_t result;
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
+#if HAVE_LIBSYSTEMD
+ sd_notify(0, "RELOADING=1\n"
+ "STATUS=reload command received\n");
+#endif /* HAVE_LIBSYSTEMD */
CHECK(loadconfig(server));
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
}
cleanup:
+#if HAVE_LIBSYSTEMD
+ sd_notifyf(0,
+ "READY=1\n"
+ "STATUS=reload command finished: %s\n",
+ isc_result_totext(result));
+#endif /* HAVE_LIBSYSTEMD */
return (result);
}
named_server_reconfigcommand(named_server_t *server) {
isc_result_t result;
atomic_store(&server->reload_status, NAMED_RELOAD_IN_PROGRESS);
+#if HAVE_LIBSYSTEMD
+ sd_notify(0, "RELOADING=1\n"
+ "STATUS=reconfig command received\n");
+#endif /* HAVE_LIBSYSTEMD */
CHECK(loadconfig(server));
atomic_store(&server->reload_status, NAMED_RELOAD_FAILED);
}
cleanup:
+#if HAVE_LIBSYSTEMD
+ sd_notifyf(0,
+ "READY=1\n"
+ "STATUS=reconfig command finished: %s\n",
+ isc_result_totext(result));
+#endif /* HAVE_LIBSYSTEMD */
return (result);
}
AC_SUBST([ZLIB_CFLAGS])
AC_SUBST([ZLIB_LIBS])
+#
+# was --with-libsystemd specified?
+#
+# [pairwise: --with-libsystemd=auto, --with-libsystemd=yes, --without-libsystemd]
+AC_ARG_WITH([libsystemd],
+ [AS_HELP_STRING([--with-libsystemd],
+ [build with libsystemd integration [default=auto]])],
+ [], [with_libsystemd=auto])
+
+AS_CASE([$with_libsystemd],
+ [no],[],
+ [auto],[PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],
+ [AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Use libsystemd library])],
+ [:])],
+ [yes],[PKG_CHECK_MODULES([LIBSYSTEMD], [libsystemd],
+ [AC_DEFINE([HAVE_LIBSYSTEMD], [1], [Use libsystemd library])])],
+ [AC_MSG_ERROR([Specifying libsystemd installation path is not supported, adjust PKG_CONFIG_PATH instead])])
+AC_SUBST([LIBSYSTEMD_CFLAGS])
+AC_SUBST([LIBSYSTEMD_LIBS])
+
#
# Check if the system supports glibc-compatible backtrace() function.
#