slurm/slurmctld-uses-xdaemon_-for-systemd.patch

49 lines
1.3 KiB
Diff
Raw Normal View History

From f0650e14983c9551fd644697285d84b35dad16aa Mon Sep 17 00:00:00 2001
From: Christian Goll <cgoll@suse.de>
Date: Mon, 9 Apr 2018 10:23:01 +0200
Subject: [PATCH 2/6] slurmctld uses xdaemon_* for systemd
---
src/slurmctld/controller.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/slurmctld/controller.c b/src/slurmctld/controller.c
index 7867e1d479..bd1c12600e 100644
--- a/src/slurmctld/controller.c
+++ b/src/slurmctld/controller.c
@@ -250,7 +250,7 @@ static bool _wait_for_server_thread(void);
/* main - slurmctld main function, start various threads and process RPCs */
int main(int argc, char **argv)
{
- int cnt, error_code, i;
+ int cnt, error_code, i, fd;
struct stat stat_buf;
struct rlimit rlim;
/* Locks: Write configuration, job, node, and partition */
@@ -298,7 +298,11 @@ int main(int argc, char **argv)
if (daemonize) {
slurmctld_config.daemonize = 1;
- if (xdaemon())
+ /*
+ * Just start daemonizing if not in test mode
+ */
+ fd = xdaemon_init();
+ if (fd == -1)
error("daemon(): %m");
log_set_timefmt(slurmctld_conf.log_fmt);
log_alter(log_opts, LOG_DAEMON,
@@ -318,6 +322,9 @@ int main(int argc, char **argv)
*/
_init_pidfile();
_become_slurm_user();
+ if (daemonize) {
+ xdaemon_finish(fd);
+ }
/*
* Create StateSaveLocation directory if necessary.
--
2.13.7