[PATCH 6/6] mdmon: allow disabling "@dmon" command name at compile time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



mdmon sets its command name to "@dmon" on distributions using systemd
to tell systemd not to kill it during shutdown.

Some older tools (e.g. the anaconda loader on RHEL6 during installation)
look specifically for "mdmon" and won't work with "@dmon". They can't be
fixed any more. So, this patch introduces the macro SYSTEMD to disable
changing the command name. Default is to assume that mdmon is started
by systemd.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 Makefile |    4 +++-
 mdmon.c  |    2 ++
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index e8da3a5..5970b90 100644
--- a/Makefile
+++ b/Makefile
@@ -77,11 +77,13 @@ MAP_PATH = $(MAP_DIR)/$(MAP_FILE)
 MDMON_DIR = $(RUN_DIR)
 # place for autoreplace cookies
 FAILED_SLOTS_DIR = $(RUN_DIR)/failed-slots
+# set SYSTEMD to 1 for distributions where mdmon is started by systemd
+SYSTEMD = 1
 SYSTEMD_DIR=/lib/systemd/system
 DIRFLAGS = -DMAP_DIR=\"$(MAP_DIR)\" -DMAP_FILE=\"$(MAP_FILE)\"
 DIRFLAGS += -DMDMON_DIR=\"$(MDMON_DIR)\"
 DIRFLAGS += -DFAILED_SLOTS_DIR=\"$(FAILED_SLOTS_DIR)\"
-CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS)
+CFLAGS = $(CWFLAGS) $(CXFLAGS) -DSendmail=\""$(MAILCMD)"\" $(CONFFILEFLAGS) $(DIRFLAGS) -DSYSTEMD=$(SYSTEMD)
 
 VERSION = $(shell [ -d .git ] && git describe HEAD | sed 's/mdadm-//')
 VERS_DATE = $(shell [ -d .git ] && date --date="`git log -n1 --format=format:%cd --date=short`" '+%0dth %B %Y' | sed -e 's/1th/1st/' -e 's/2th/2nd/' -e 's/11st/11th/' -e 's/12nd/12th/')
diff --git a/mdmon.c b/mdmon.c
index f0b0623..132b469 100644
--- a/mdmon.c
+++ b/mdmon.c
@@ -298,6 +298,7 @@ int main(int argc, char *argv[])
 		{NULL, 0, NULL, 0}
 	};
 
+#if (SYSTEMD == 1)
 	if (in_initrd()) {
 		/*
 		 * set first char of argv[0] to @. This is used by
@@ -306,6 +307,7 @@ int main(int argc, char *argv[])
 		 */
 		argv[0][0] = '@';
 	}
+#endif
 
 	while ((opt = getopt_long(argc, argv, "thaF", options, NULL)) != -1) {
 		switch (opt) {
-- 
1.7.3.4
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux