int run_child(void *v)
{
struct supertype *c = v;
+ sigset_t set;
+ /* SIGUSR is sent from child to parent, So child must block it */
+ sigemptyset(&set);
+ sigaddset(&set, SIGUSR1);
+ sigprocmask(SIG_BLOCK, &set, NULL);
+
do_monitor(c);
return 0;
}
kill(pid, SIGTERM);
}
+void remove_pidfile(char *devname)
+{
+ char buf[100];
+
+ sprintf(buf, "/var/run/mdadm/%s.pid", devname);
+ unlink(buf);
+}
+
static int make_control_sock(char *devname)
{
char path[100];
/* hopefully it is a container - we'll check later */
container = malloc(sizeof(*container));
- container->devfd = mdfd;
container->devnum = fd2devnum(mdfd);
container->devname = devnum2devname(container->devnum);
+ container->device_name = argv[1];
/* If this fails, we hope it already exists */
mkdir("/var/run/mdadm", 0600);
argv[1]);
exit(3);
}
-
+ close(mdfd);
+ close(mdfd);
mlockall(MCL_FUTURE);