aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/configure.in3
-rw-r--r--erts/epmd/src/epmd.c8
-rw-r--r--erts/epmd/src/epmd_srv.c5
3 files changed, 12 insertions, 4 deletions
diff --git a/erts/configure.in b/erts/configure.in
index 9864d03cde..a594d59355 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -1691,10 +1691,13 @@ systemd_daemon_save_LIBS=$LIBS
LIBS=
AC_SEARCH_LIBS(sd_listen_fds,[systemd systemd-daemon],
[have_sd_listen_fds=yes],[have_sd_listen_fds=no],$systemd_daemon_save_LIBS)
+AC_SEARCH_LIBS(sd_notify,[systemd systemd-daemon],
+ [have_sd_notify=yes],[have_sd_notify=no],$systemd_daemon_save_LIBS)
AC_CHECK_HEADERS(systemd/sd-daemon.h,
[have_systemd_sd_daemon_h=yes],[have_systemd_sd_daemon_h=no])
if test x"$have_sd_listen_fds" = x"yes" && \
+ test x"$have_sd_notify" = x"yes" && \
test x"$have_systemd_sd_daemon_h" = x"yes"; then
AC_DEFINE([HAVE_SYSTEMD_DAEMON],[1],[Define if you have systemd daemon])
SYSTEMD_DAEMON_LIBS=$LIBS
diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c
index 9630e0cdf0..dff9bc64de 100644
--- a/erts/epmd/src/epmd.c
+++ b/erts/epmd/src/epmd.c
@@ -593,9 +593,11 @@ void epmd_cleanup_exit(EpmdVars *g, int exitval)
for(i=0; g->argv[i] != NULL; ++i)
free(g->argv[i]);
free(g->argv);
- }
-
-
+ }
+#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+ sd_notifyf(0, "STATUS=Exited.\n"
+ "ERRNO=%i", exitval);
+#endif // HAVE_SYSTEMD_SD_DAEMON_H
exit(exitval);
}
diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c
index 48fd7a5f9c..18d898a915 100644
--- a/erts/epmd/src/epmd_srv.c
+++ b/erts/epmd/src/epmd_srv.c
@@ -399,8 +399,11 @@ void run(EpmdVars *g)
}
select_fd_set(g, listensock[i]);
}
-#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+#ifdef HAVE_SYSTEMD_SD_DAEMON_H
}
+ sd_notifyf(0, "READY=1\n"
+ "STATUS=Processing port mapping requests...\n"
+ "MAINPID=%lu", (unsigned long) getpid());
#endif
dbg_tty_printf(g,2,"entering the main select() loop");