summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2004-04-09 23:57:18 +0000
committerBrad Smith <brad@cvs.openbsd.org>2004-04-09 23:57:18 +0000
commit532b010acd41eb6be65331811f56f59d79403912 (patch)
tree718deb9e3f7b9b1ebdb3cbfa83961b8f0a6c965d /lib
parentfcbd6ff1a91e75c3aa7558504a3410c0ba09ce38 (diff)
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. From: FreeBSD's libc_r ok marc@
Diffstat (limited to 'lib')
-rw-r--r--lib/libpthread/uthread/uthread_kern.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_kern.c b/lib/libpthread/uthread/uthread_kern.c
index ef9d87957b0..c14810d0943 100644
--- a/lib/libpthread/uthread/uthread_kern.c
+++ b/lib/libpthread/uthread/uthread_kern.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_kern.c,v 1.27 2003/05/13 16:49:32 marc Exp $ */
+/* $OpenBSD: uthread_kern.c,v 1.28 2004/04/09 23:57:17 brad Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -795,7 +795,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);
@@ -807,7 +809,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);