+ /* SIGUSR is sent between parent and child. So both block it
+ * and enable it only with pselect.
+ */
+ sigemptyset(&set);
+ sigaddset(&set, SIGUSR1);
+ sigaddset(&set, SIGHUP);
+ sigaddset(&set, SIGALRM);
+ sigaddset(&set, SIGTERM);
+ sigprocmask(SIG_BLOCK, &set, NULL);
+ act.sa_handler = wake_me;
+ act.sa_flags = 0;
+ sigaction(SIGUSR1, &act, NULL);
+ sigaction(SIGALRM, &act, NULL);
+ act.sa_handler = hup;
+ sigaction(SIGHUP, &act, NULL);
+ act.sa_handler = term;
+ sigaction(SIGTERM, &act, NULL);
+ act.sa_handler = SIG_IGN;
+ sigaction(SIGPIPE, &act, NULL);
+
+ if (switchroot) {
+ /* we assume we assume that /sys /proc /dev are available in
+ * the new root (see nash:setuproot)
+ *
+ * kill any monitors in the current namespace and change
+ * to the new one
+ */
+ try_kill_monitor(container->devname);
+ if (chroot(switchroot) != 0) {
+ fprintf(stderr, "mdmon: failed to chroot to '%s': %s\n",
+ switchroot, strerror(errno));
+ exit(4);
+ }
+ }