diff options
author | NeilBrown <neilb@suse.de> | 2009-04-14 14:59:24 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-04-14 14:59:24 +1000 |
commit | 2800528713cd32a4d12d7e17c14eba34eb8a4ec2 (patch) | |
tree | f80c016a09255e2fc3d5c3bab864ca0be46fa588 /mdstat.c | |
parent | c256924e52249b52bad42963176c42601f1a08f4 (diff) | |
download | mdadm-2800528713cd32a4d12d7e17c14eba34eb8a4ec2.tar.gz |
Wait for POLLPRI on /proc or /sys files.
From 2.6.30, /proc/mounts and various /sys files will
probably always returns 'readable' to select, so we will need
to wait on POLLPRI to get the 'new data is available' signal.
When using select, this corresponds to an 'exception', so
adjust calls to select accordingly.
In one case we sometimes wait on a socket and sometime on
/proc/mounts, so we need to test which.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'mdstat.c')
-rw-r--r-- | mdstat.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -280,8 +280,18 @@ void mdstat_wait_fd(int fd, const sigset_t *sigmask) FD_ZERO(&rfds); if (mdstat_fd >= 0) FD_SET(mdstat_fd, &fds); - if (fd >= 0) - FD_SET(fd, &rfds); + if (fd >= 0) { + struct stat stb; + fstat(fd, &stb); + if ((stb.st_mode & S_IFMT) == S_IFREG) + /* Must be a /proc or /sys fd, so expect + * POLLPRI + * i.e. an 'exceptional' event. + */ + FD_SET(fd, &fds); + else + FD_SET(fd, &rfds); + } if (mdstat_fd > maxfd) maxfd = mdstat_fd; |