summaryrefslogtreecommitdiff
path: root/lib/libpthread/uthread
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2003-11-03 20:27:49 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2003-11-03 20:27:49 +0000
commit725c0784184bf4cb7cb0c1f4d9f35954ffbe260d (patch)
tree394ea42c54f5c6cb21c9cad07606ee43a117d0bc /lib/libpthread/uthread
parentc5ffb72991f6abd13c1d087bd4f55745a5d729bf (diff)
replace magic number for min number of poll_data entries
to allocate with a define
Diffstat (limited to 'lib/libpthread/uthread')
-rw-r--r--lib/libpthread/uthread/uthread_select.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/libpthread/uthread/uthread_select.c b/lib/libpthread/uthread/uthread_select.c
index 33620ffc254..b3a227b474e 100644
--- a/lib/libpthread/uthread/uthread_select.c
+++ b/lib/libpthread/uthread/uthread_select.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uthread_select.c,v 1.8 2003/10/19 22:49:11 marc Exp $ */
+/* $OpenBSD: uthread_select.c,v 1.9 2003/11/03 20:27:48 marc Exp $ */
/*
* Copyright (c) 1995-1998 John Birrell <jb@cimlogic.com.au>
* All rights reserved.
@@ -45,6 +45,11 @@
#include <pthread.h>
#include "pthread_private.h"
+/*
+ * Minimum number of poll_data entries to allocate
+ */
+#define POLLDATA_MIN 128
+
int
select(int numfds, fd_set * readfds, fd_set * writefds,
fd_set * exceptfds, struct timeval * timeout)
@@ -102,7 +107,7 @@ select(int numfds, fd_set * readfds, fd_set * writefds,
if ((curthread->poll_data.fds == NULL) ||
(curthread->poll_data.nfds < fd_count)) {
data.fds = (struct pollfd *) realloc(curthread->poll_data.fds,
- sizeof(struct pollfd) * MAX(128, fd_count));
+ sizeof(struct pollfd) * MAX(POLLDATA_MIN, fd_count));
if (data.fds == NULL) {
errno = ENOMEM;
ret = -1;
@@ -114,7 +119,7 @@ select(int numfds, fd_set * readfds, fd_set * writefds,
* currently being polled.
*/
curthread->poll_data.fds = data.fds;
- curthread->poll_data.nfds = MAX(128, fd_count);
+ curthread->poll_data.nfds = MAX(POLLDATA_MIN, fd_count);
}
}
if (ret == 0) {