{
struct mdstat_ent *mdstat;
sigset_t set;
- int proc_fd;
sigprocmask(SIG_UNBLOCK, NULL, &set);
sigdelset(&set, SIGUSR1);
sigdelset(&set, SIGHUP);
sigdelset(&set, SIGALRM);
sigdelset(&set, SIGTERM);
- proc_fd = open("/proc/mounts", O_RDONLY);
do {
char *dir = ALT_RUN;
if (mkdir(dir, 0600) < 0 && errno != EEXIST)
dir = NULL;
- } else {
- if (proc_fd >= 0)
- close(proc_fd);
- proc_fd = -1;
}
if (dir && !sigterm &&
(container->sock < 0 ||
wakeup_monitor();
if (update_queue == NULL)
- mdstat_wait_fd(container->sock, proc_fd, &set);
+ mdstat_wait_fd(container->sock, &set);
else
/* If an update is happening, just wait for signal */
pselect(0, NULL, NULL, NULL, NULL, &set);
extern struct mdstat_ent *mdstat_read(int hold, int start);
extern void free_mdstat(struct mdstat_ent *ms);
extern void mdstat_wait(int seconds);
-extern void mdstat_wait_fd(int fd, int fd2, const sigset_t *sigmask);
+extern void mdstat_wait_fd(int fd, const sigset_t *sigmask);
extern int mddev_busy(int devnum);
struct map_ent {
select(maxfd + 1, NULL, NULL, &fds, &tm);
}
-void mdstat_wait_fd(int fd, int fd2, const sigset_t *sigmask)
+void mdstat_wait_fd(int fd, const sigset_t *sigmask)
{
fd_set fds, rfds;
int maxfd = 0;
if (mdstat_fd >= 0)
FD_SET(mdstat_fd, &fds);
- if (fd < 0)
- fd = fd2, fd2 = -1;
-
- while (fd >= 0) {
+ if (fd >= 0) {
struct stat stb;
fstat(fd, &stb);
if ((stb.st_mode & S_IFMT) == S_IFREG)
if (fd > maxfd)
maxfd = fd;
- fd = fd2;
- fd2 = -1;
}
if (mdstat_fd > maxfd)
maxfd = mdstat_fd;