diff options
author | archie <archie@FreeBSD.org> | 2002-08-29 00:44:11 +0000 |
---|---|---|
committer | archie <archie@FreeBSD.org> | 2002-08-29 00:44:11 +0000 |
commit | 18b0669383969e956ef080c81d22cc5762848da0 (patch) | |
tree | 469c29a146f1d99cc3c272852cc2252ff3475d5f | |
parent | 3177d246be6fe17cfcbc545dbde8ebd2b515dc47 (diff) | |
download | FreeBSD-src-18b0669383969e956ef080c81d22cc5762848da0.zip FreeBSD-src-18b0669383969e956ef080c81d22cc5762848da0.tar.gz |
When poll(2)'ing for readability or writability of a file descriptor
on behalf of a thread, we should check the POLLERR, POLLHUP, and
POLLNVAL flags as well to wake up the thread in these cases.
Suggested by: deischen
MFC after: 3 days
-rw-r--r-- | lib/libc_r/uthread/uthread_kern.c | 8 | ||||
-rw-r--r-- | lib/libkse/thread/thr_kern.c | 8 | ||||
-rw-r--r-- | lib/libpthread/thread/thr_kern.c | 8 |
3 files changed, 18 insertions, 6 deletions
diff --git a/lib/libc_r/uthread/uthread_kern.c b/lib/libc_r/uthread/uthread_kern.c index 2bd855c..55296eb 100644 --- a/lib/libc_r/uthread/uthread_kern.c +++ b/lib/libc_r/uthread/uthread_kern.c @@ -880,7 +880,9 @@ thread_kern_poll(int wait_reqd) /* File descriptor read wait: */ case PS_FDR_WAIT: if ((nfds < _thread_dtablesize) && - (_thread_pfd_table[nfds].revents & POLLRDNORM)) { + (_thread_pfd_table[nfds].revents + & (POLLRDNORM|POLLERR|POLLHUP|POLLNVAL)) + != 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); PTHREAD_NEW_STATE(pthread,PS_RUNNING); @@ -892,7 +894,9 @@ thread_kern_poll(int wait_reqd) /* File descriptor write wait: */ case PS_FDW_WAIT: if ((nfds < _thread_dtablesize) && - (_thread_pfd_table[nfds].revents & POLLWRNORM)) { + (_thread_pfd_table[nfds].revents + & (POLLWRNORM|POLLERR|POLLHUP|POLLNVAL)) + != 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); PTHREAD_NEW_STATE(pthread,PS_RUNNING); diff --git a/lib/libkse/thread/thr_kern.c b/lib/libkse/thread/thr_kern.c index 2bd855c..55296eb 100644 --- a/lib/libkse/thread/thr_kern.c +++ b/lib/libkse/thread/thr_kern.c @@ -880,7 +880,9 @@ thread_kern_poll(int wait_reqd) /* File descriptor read wait: */ case PS_FDR_WAIT: if ((nfds < _thread_dtablesize) && - (_thread_pfd_table[nfds].revents & POLLRDNORM)) { + (_thread_pfd_table[nfds].revents + & (POLLRDNORM|POLLERR|POLLHUP|POLLNVAL)) + != 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); PTHREAD_NEW_STATE(pthread,PS_RUNNING); @@ -892,7 +894,9 @@ thread_kern_poll(int wait_reqd) /* File descriptor write wait: */ case PS_FDW_WAIT: if ((nfds < _thread_dtablesize) && - (_thread_pfd_table[nfds].revents & POLLWRNORM)) { + (_thread_pfd_table[nfds].revents + & (POLLWRNORM|POLLERR|POLLHUP|POLLNVAL)) + != 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); PTHREAD_NEW_STATE(pthread,PS_RUNNING); diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index 2bd855c..55296eb 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -880,7 +880,9 @@ thread_kern_poll(int wait_reqd) /* File descriptor read wait: */ case PS_FDR_WAIT: if ((nfds < _thread_dtablesize) && - (_thread_pfd_table[nfds].revents & POLLRDNORM)) { + (_thread_pfd_table[nfds].revents + & (POLLRDNORM|POLLERR|POLLHUP|POLLNVAL)) + != 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); PTHREAD_NEW_STATE(pthread,PS_RUNNING); @@ -892,7 +894,9 @@ thread_kern_poll(int wait_reqd) /* File descriptor write wait: */ case PS_FDW_WAIT: if ((nfds < _thread_dtablesize) && - (_thread_pfd_table[nfds].revents & POLLWRNORM)) { + (_thread_pfd_table[nfds].revents + & (POLLWRNORM|POLLERR|POLLHUP|POLLNVAL)) + != 0) { PTHREAD_WAITQ_CLEARACTIVE(); PTHREAD_WORKQ_REMOVE(pthread); PTHREAD_NEW_STATE(pthread,PS_RUNNING); |