" --query -Q : Display general information about how a\n"
" device relates to the md driver\n"
" --auto-detect : Start arrays auto-detected by the kernel\n"
-" --offroot : Set first character of argv[0] to @ to indicate the\n"
-" application was launched from initrd/initramfs and\n"
-" should not be shutdown by systemd as part of the\n"
-" regular shutdown process.\n"
;
/*
"\n"
.I mdadm
will be silent unless there is something really important to report.
-.TP
-.BR \-\-offroot
-Set first character of argv[0] to @ to indicate mdadm was launched
-from initrd/initramfs and should not be shutdown by systemd as part of
-the regular shutdown process. This option is normally only used by
-the system's initscripts. Please see here for more details on how
-systemd handled argv[0]:
-.IP
-.B http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
-.PP
-
.TP
.BR \-f ", " \-\-force
ident.container = NULL;
ident.member = NULL;
+ /*
+ * set first char of argv[0] to @. This is used by
+ * systemd to signal that the task was launched from
+ * initrd/initramfs and should be preserved during shutdown
+ */
+ argv[0][0] = '@';
+
while ((option_index = -1) ,
(opt=getopt_long(argc, argv,
shortopt, long_options,
c.homehost = optarg;
continue;
- /*
- * --offroot sets first char of argv[0] to @. This is used
- * by systemd to signal that the task was launched from
- * initrd/initramfs and should be preserved during shutdown
- */
case OffRootOpt:
- argv[0][0] = '@';
- __offroot = 1;
+ /* Silently ignore old option */
continue;
case Prefer:
#define INVALID_SECTORS 1
/* And another special number needed for --data_offset=variable */
#define VARIABLE_OFFSET 3
-
-extern int __offroot;
.SH SYNOPSIS
-.BI mdmon " [--all] [--takeover] [--offroot] CONTAINER"
+.BI mdmon " [--all] [--takeover] CONTAINER"
.SH OVERVIEW
The 2.6.27 kernel brings the ability to support external metadata arrays.
arbitrarily extended, e.g. to
.BR \-\-all-active-arrays .
.TP
-.BR \-\-offroot
-Set first character of argv[0] to @ to indicate mdmon was launched
-from initrd/initramfs and should not be shutdown by systemd as part of
-the regular shutdown process. This option is normally only used by
-the system's initscripts. Please see here for more details on how
-systemd handled argv[0]:
-.IP
-.B http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons
-.PP
.PP
Note that
buf[sizeof(buf)-1] = 0;
close(fd);
- /* Note that if started with --offroot, the name
- * might be "@dmon"
- */
if (n < 0 || !(strstr(buf, "mdmon") ||
strstr(buf, "@dmon")))
return;
" --help -h : This message\n"
" --all : All devices\n"
" --takeover -t : Takeover container\n"
-" --offroot : Set first character of argv[0] to @ to indicate the\n"
-" application was launched from initrd/initramfs and\n"
-" should not be shutdown by systemd as part of the\n"
-" regular shutdown process.\n"
);
exit(2);
}
{NULL, 0, NULL, 0}
};
+ /*
+ * Always change process name to @dmon to avoid systemd killing it
+ */
+ argv[0][0] = '@';
+
while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) {
switch (opt) {
case 'a':
takeover = 1;
break;
case OffRootOpt:
- argv[0][0] = '@';
+ /* silently ignore old option */
break;
case 'h':
default:
#include <dirent.h>
#include <signal.h>
-int __offroot;
-
/*
* following taken from linux/blkpg.h because they aren't
* anywhere else and it isn't safe to #include linux/ * stuff.
for (i = 0; paths[i]; i++)
if (paths[i][0]) {
- if (__offroot) {
- execl(paths[i], "mdmon", "--offroot",
- devnum2devname(devnum),
- NULL);
- } else {
- execl(paths[i], "mdmon",
- devnum2devname(devnum),
- NULL);
- }
+ execl(paths[i], "mdmon",
+ devnum2devname(devnum), NULL);
}
exit(1);
case -1: pr_err("cannot run mdmon. "