aboutsummaryrefslogtreecommitdiffstats
path: root/erts/epmd/src/epmd.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2014-11-25 11:53:24 +0100
committerLukas Larsson <[email protected]>2014-11-25 11:53:24 +0100
commitc181536aabe2140d3547ba34c6b7ef2ae0109c65 (patch)
treee8e7d7844481b19fb6726146c166eee9c9edf30e /erts/epmd/src/epmd.c
parent872fa86ddebbc84b07dc5426d25f7fb300731f52 (diff)
parent5db2345baa3bb9c835f91aafac3dde6e595debc7 (diff)
downloadotp-c181536aabe2140d3547ba34c6b7ef2ae0109c65.tar.gz
otp-c181536aabe2140d3547ba34c6b7ef2ae0109c65.tar.bz2
otp-c181536aabe2140d3547ba34c6b7ef2ae0109c65.zip
Merge branch 'lem/epmd_sd_notify/OTP-12321' into maint
* lem/epmd_sd_notify/OTP-12321: epmd: Unify systemd autoconf macros usage epmd: Added systemd notify support to EPMD
Diffstat (limited to 'erts/epmd/src/epmd.c')
-rw-r--r--erts/epmd/src/epmd.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c
index 9630e0cdf0..9699491526 100644
--- a/erts/epmd/src/epmd.c
+++ b/erts/epmd/src/epmd.c
@@ -175,9 +175,9 @@ int main(int argc, char** argv)
g->nodes.reg = g->nodes.unreg = g->nodes.unreg_tail = NULL;
g->nodes.unreg_count = 0;
g->active_conn = 0;
-#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+#ifdef HAVE_SYSTEMD_DAEMON
g->is_systemd = 0;
-#endif
+#endif /* HAVE_SYSTEMD_DAEMON */
for (i = 0; i < MAX_LISTEN_SOCKETS; i++)
g->listenfd[i] = -1;
@@ -251,11 +251,11 @@ int main(int argc, char** argv)
else
usage(g);
epmd_cleanup_exit(g,0);
-#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+#ifdef HAVE_SYSTEMD_DAEMON
} else if (strcmp(argv[0], "-systemd") == 0) {
g->is_systemd = 1;
argv++; argc--;
-#endif
+#endif /* HAVE_SYSTEMD_DAEMON */
} else
usage(g);
}
@@ -461,11 +461,11 @@ static void usage(EpmdVars *g)
fprintf(stderr, " Forcibly unregisters a name with epmd\n");
fprintf(stderr, " (only allowed if -relaxed_command_check was given when \n");
fprintf(stderr, " epmd was started).\n");
-#ifdef HAVE_SYSTEMD_SD_DAEMON_H
+#ifdef HAVE_SYSTEMD_DAEMON
fprintf(stderr, " -systemd\n");
fprintf(stderr, " Wait for socket from systemd. The option makes sense\n");
fprintf(stderr, " when started from .socket unit.\n");
-#endif
+#endif /* HAVE_SYSTEMD_DAEMON */
epmd_cleanup_exit(g,1);
}
@@ -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_DAEMON
+ sd_notifyf(0, "STATUS=Exited.\n"
+ "ERRNO=%i", exitval);
+#endif /* HAVE_SYSTEMD_DAEMON */
exit(exitval);
}