summaryrefslogtreecommitdiff
path: root/mdstat.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2010-02-04 16:31:49 +1100
committerNeilBrown <neilb@suse.de>2010-02-04 16:47:28 +1100
commit5d4d1b26d3da8b489ed7e2f5a38f7d90b7f4008f (patch)
tree86261d4f1521d7953bdbde959fd96bd0fb744d9c /mdstat.c
parent24f6f99b3630b1a89aaa57930c5c9de8a3df9ded (diff)
mdmon: allow pid to be stored in different directory.
/var/run probably doesn't persist from early boot. So if necessary, store in in /lib/init/rw or somewhere else that does persist. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdstat.c')
-rw-r--r--mdstat.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/mdstat.c b/mdstat.c
index 4d2f473e..4b3f6fec 100644
--- a/mdstat.c
+++ b/mdstat.c
@@ -266,16 +266,20 @@ void mdstat_wait(int seconds)
select(maxfd + 1, NULL, NULL, &fds, &tm);
}
-void mdstat_wait_fd(int fd, const sigset_t *sigmask)
+void mdstat_wait_fd(int fd, int fd2, const sigset_t *sigmask)
{
fd_set fds, rfds;
- int maxfd = fd;
+ int maxfd = 0;
FD_ZERO(&fds);
FD_ZERO(&rfds);
if (mdstat_fd >= 0)
FD_SET(mdstat_fd, &fds);
- if (fd >= 0) {
+
+ if (fd < 0)
+ fd = fd2, fd2 = -1;
+
+ while (fd >= 0) {
struct stat stb;
fstat(fd, &stb);
if ((stb.st_mode & S_IFMT) == S_IFREG)
@@ -286,6 +290,12 @@ void mdstat_wait_fd(int fd, const sigset_t *sigmask)
FD_SET(fd, &fds);
else
FD_SET(fd, &rfds);
+
+ if (fd > maxfd)
+ maxfd = fd;
+
+ fd = fd2;
+ fd2 = -1;
}
if (mdstat_fd > maxfd)
maxfd = mdstat_fd;