#include "mdadm.h"
#include "mdmon.h"
+char const Name[] = "mdmon";
+
struct active_array *discard_this;
struct active_array *pending_discard;
addr.sun_family = PF_LOCAL;
strcpy(addr.sun_path, path);
- if (bind(sfd, &addr, sizeof(addr)) < 0) {
+ umask(077); /* ensure no world write access */
+ if (bind(sfd, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
close(sfd);
return -1;
}
{NULL, 0, NULL, 0}
};
- /*
- * Always change process name to @dmon to avoid systemd killing it
- */
- argv[0][0] = '@';
+ if (in_initrd()) {
+ /*
+ * 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 ((opt = getopt_long(argc, argv, "thaF", options, NULL)) != -1) {
switch (opt) {
dofork = 0;
break;
case OffRootOpt:
- /* silently ignore old option */
+ argv[0][0] = '@';
break;
case 'h':
default:
pr_err("%s: %s\n", devnm, strerror(errno));
return 1;
}
- if (md_get_version(mdfd) < 0) {
- pr_err("%s: Not an md device\n", devnm);
- return 1;
- }
/* Fork, and have the child tell us when they are ready */
if (must_fork) {
wait(&status);
status = WEXITSTATUS(status);
}
+ close(pfd[0]);
return status;
}
} else
container->sock = make_control_sock(devnm);
status = 0;
- if (write(pfd[1], &status, sizeof(status)) < 0)
- pr_err("failed to notify our parent: %d\n",
- getppid());
- close(pfd[1]);
+ if (pfd[1] >= 0) {
+ if (write(pfd[1], &status, sizeof(status)) < 0)
+ pr_err("failed to notify our parent: %d\n",
+ getppid());
+ close(pfd[1]);
+ }
mlockall(MCL_CURRENT | MCL_FUTURE);
return 1;
}
-void abort_reshape(struct mdinfo *sra)
-{
- return;
-}
-
int save_stripes(int *source, unsigned long long *offsets,
int raid_disks, int chunk_size, int level, int layout,
int nwrites, int *dest,
{
return 0;
}
+
+struct superswitch super0 = {
+ .name = "0.90",
+};
+struct superswitch super1 = {
+ .name = "1.x",
+};