From 0585732b625744b86105f221547d62765ca051be Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Jun 06 2014 12:31:36 +0000 Subject: Change EPMD service type to Notify Signed-off-by: Peter Lemenkov --- diff --git a/epmd.service b/epmd.service index 02c7e36..6881195 100644 --- a/epmd.service +++ b/epmd.service @@ -6,7 +6,7 @@ Requires=epmd.socket [Service] ExecStart=/usr/bin/epmd -systemd #ExecStop=/usr/bin/epmd -kill -Type=simple +Type=notify StandardOutput=journal StandardError=journal DeviceAllow=/dev/null rw diff --git a/epmd@.socket b/epmd@.socket new file mode 100644 index 0000000..5dda63d --- /dev/null +++ b/epmd@.socket @@ -0,0 +1,10 @@ +[Unit] +Description=Erlang Port Mapper Daemon Activation Socket + +[Socket] +ListenStream=%i:4369 +Accept=false + +[Install] +WantedBy=sockets.target + diff --git a/erlang.spec b/erlang.spec index e77d45f..e19b890 100644 --- a/erlang.spec +++ b/erlang.spec @@ -32,7 +32,7 @@ Name: erlang Version: %{upstream_ver} -Release: %{upstream_rel_for_rpm}.5%{?dist} +Release: %{upstream_rel_for_rpm}.6%{?dist} Summary: General-purpose programming language and runtime environment Group: Development/Languages @@ -46,6 +46,7 @@ Source2: http://erlang.org/download/otp_doc_man_%{upstream_ver}%{upstream_rel}-1 Source4: http://www.erlang.org/download/otp_src_%{upstream_ver}%{upstream_rel}-1.readme Source5: epmd.service Source6: epmd.socket +Source7: epmd@.socket Source999: otp-get-patches.sh @@ -99,6 +100,9 @@ Patch11: otp-0011-Add-systemd-option-to-empd.-Check-for-include-system.patch # Fedora specific patch # Add systemd support to epmd Patch12: otp-0012-Add-systemd-support-to-epmd.patch +# Fedora specific patch +# Added systemd notify support to EPMD +Patch13: otp-0013-Added-systemd-notify-support-to-EPMD.patch # end of autogenerated patch tag list # BuildRoot not strictly needed since F10, but keep it for spec file robustness @@ -977,6 +981,7 @@ Erlang mode for XEmacs (source lisp files). %patch10 -p1 -b .Fix_for_powerpc_architecture %patch11 -p1 -b .Add_systemd_option_to_empd_Check_for_include_system %patch12 -p1 -b .Add_systemd_support_to_epmd +%patch13 -p1 -b .Added_systemd_notify_support_to_EPMD # end of autogenerated prep patch list # FIXME we should come up with a better solution @@ -1176,6 +1181,7 @@ ln -s "${jinterface_lib_dir}priv/OtpErlang.jar" "$RPM_BUILD_ROOT%{_javadir}/%{na %if 0%{?el7}%{?fedora} install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_unitdir}/epmd.service install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/epmd.socket +install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/epmd@.socket %endif @@ -2325,6 +2331,10 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Fri Jun 06 2014 Peter Lemenkov - R16B-03.6 +- Add configurable EPMD socket unit +- Change EPMD service's type from simple to notify + * Wed Apr 02 2014 Peter Lemenkov - R16B-03.5 - Improve EPMD service diff --git a/otp-0013-Added-systemd-notify-support-to-EPMD.patch b/otp-0013-Added-systemd-notify-support-to-EPMD.patch new file mode 100644 index 0000000..b41ce99 --- /dev/null +++ b/otp-0013-Added-systemd-notify-support-to-EPMD.patch @@ -0,0 +1,45 @@ +From: Peter Lemenkov +Date: Fri, 6 Jun 2014 15:29:49 +0400 +Subject: [PATCH] Added systemd notify support to EPMD + +Signed-off-by: Peter Lemenkov + +Conflicts: + erts/configure.in + +diff --git a/erts/epmd/src/epmd.c b/erts/epmd/src/epmd.c +index fc58882..1757fa9 100644 +--- a/erts/epmd/src/epmd.c ++++ b/erts/epmd/src/epmd.c +@@ -589,9 +589,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 cb8ca96..78524a6 100644 +--- a/erts/epmd/src/epmd_srv.c ++++ b/erts/epmd/src/epmd_srv.c +@@ -394,8 +394,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");