Index: trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h
===================================================================
--- trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h	(revision 101812)
+++ trunk/src/libs/xpcom18a4/nsprpub/pr/include/private/primpl.h	(revision 101813)
@@ -456,8 +456,4 @@
     struct pollfd *syspoll_list;    /* Unix polling list used by PR_Poll */
     PRUint32 syspoll_count;         /* number of elements in syspoll_list */
-#if defined(_PR_POLL_WITH_SELECT)
-    int *selectfd_list;             /* Unix fd's that PR_Poll selects on */
-    PRUint32 selectfd_count;        /* number of elements in selectfd_list */
-#endif
 };
 
Index: trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c
===================================================================
--- trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c	(revision 101812)
+++ trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptio.c	(revision 101813)
@@ -41,11 +41,4 @@
 */
 
-#if defined(_PR_POLL_WITH_SELECT)
-#if !(defined(HPUX) && defined(_USE_BIG_FDS))
-/* set fd limit for select(), before including system header files */
-#define FD_SETSIZE (16 * 1024)
-#endif
-#endif
-
 #include <pthread.h>
 #include <string.h>  /* for memset() */
@@ -293,9 +286,4 @@
  */
 #define PT_DEFAULT_POLL_MSEC 5000
-#if defined(_PR_POLL_WITH_SELECT)
-#define PT_DEFAULT_SELECT_SEC (PT_DEFAULT_POLL_MSEC/PR_MSEC_PER_SEC)
-#define PT_DEFAULT_SELECT_USEC							\
-		((PT_DEFAULT_POLL_MSEC % PR_MSEC_PER_SEC) * PR_USEC_PER_MSEC)
-#endif
 
 /*
@@ -413,156 +401,4 @@
 #endif  /* DEBUG */
 
-#if defined(_PR_POLL_WITH_SELECT)
-/*
- * OSF1 and HPUX report the POLLHUP event for a socket when the
- * shutdown(SHUT_WR) operation is called for the remote end, even though
- * the socket is still writeable. Use select(), instead of poll(), to
- * workaround this problem.
- */
-static void pt_poll_now_with_select(pt_Continuation *op)
-{
-    PRInt32 msecs;
-	fd_set rd, wr, *rdp, *wrp;
-	struct timeval tv;
-	PRIntervalTime epoch, now, elapsed, remaining;
-	PRBool wait_for_remaining;
-    PRThread *self = PR_GetCurrentThread();
-
-	PR_ASSERT(PR_INTERVAL_NO_WAIT != op->timeout);
-	PR_ASSERT(op->arg1.osfd < FD_SETSIZE);
-
-    switch (op->timeout) {
-        case PR_INTERVAL_NO_TIMEOUT:
-			tv.tv_sec = PT_DEFAULT_SELECT_SEC;
-			tv.tv_usec = PT_DEFAULT_SELECT_USEC;
-			do
-			{
-				PRIntn rv;
-
-				if (op->event & POLLIN) {
-					FD_ZERO(&rd);
-					FD_SET(op->arg1.osfd, &rd);
-					rdp = &rd;
-				} else
-					rdp = NULL;
-				if (op->event & POLLOUT) {
-					FD_ZERO(&wr);
-					FD_SET(op->arg1.osfd, &wr);
-					wrp = &wr;
-				} else
-					wrp = NULL;
-
-				rv = select(op->arg1.osfd + 1, rdp, wrp, NULL, &tv);
-
-				if (self->state & PT_THREAD_ABORTED)
-				{
-					self->state &= ~PT_THREAD_ABORTED;
-					op->result.code = -1;
-					op->syserrno = EINTR;
-					op->status = pt_continuation_done;
-					return;
-				}
-
-				if ((-1 == rv) && ((errno == EINTR) || (errno == EAGAIN)))
-					continue; /* go around the loop again */
-
-				if (rv > 0)
-				{
-					PRInt16 revents = 0;
-
-					if ((op->event & POLLIN) && FD_ISSET(op->arg1.osfd, &rd))
-						revents |= POLLIN;
-					if ((op->event & POLLOUT) && FD_ISSET(op->arg1.osfd, &wr))
-						revents |= POLLOUT;
-
-					if (op->function(op, revents))
-						op->status = pt_continuation_done;
-				} else if (rv == -1) {
-					op->result.code = -1;
-					op->syserrno = errno;
-					op->status = pt_continuation_done;
-				}
-				/* else, select timed out */
-			} while (pt_continuation_done != op->status);
-			break;
-        default:
-            now = epoch = PR_IntervalNow();
-            remaining = op->timeout;
-			do
-			{
-				PRIntn rv;
-
-				if (op->event & POLLIN) {
-					FD_ZERO(&rd);
-					FD_SET(op->arg1.osfd, &rd);
-					rdp = &rd;
-				} else
-					rdp = NULL;
-				if (op->event & POLLOUT) {
-					FD_ZERO(&wr);
-					FD_SET(op->arg1.osfd, &wr);
-					wrp = &wr;
-				} else
-					wrp = NULL;
-
-    			wait_for_remaining = PR_TRUE;
-    			msecs = (PRInt32)PR_IntervalToMilliseconds(remaining);
-				if (msecs > PT_DEFAULT_POLL_MSEC) {
-					wait_for_remaining = PR_FALSE;
-					msecs = PT_DEFAULT_POLL_MSEC;
-				}
-				tv.tv_sec = msecs/PR_MSEC_PER_SEC;
-				tv.tv_usec = (msecs % PR_MSEC_PER_SEC) * PR_USEC_PER_MSEC;
-				rv = select(op->arg1.osfd + 1, rdp, wrp, NULL, &tv);
-
-				if (self->state & PT_THREAD_ABORTED)
-				{
-					self->state &= ~PT_THREAD_ABORTED;
-					op->result.code = -1;
-					op->syserrno = EINTR;
-					op->status = pt_continuation_done;
-					return;
-				}
-
-				if (rv > 0) {
-					PRInt16 revents = 0;
-
-					if ((op->event & POLLIN) && FD_ISSET(op->arg1.osfd, &rd))
-						revents |= POLLIN;
-					if ((op->event & POLLOUT) && FD_ISSET(op->arg1.osfd, &wr))
-						revents |= POLLOUT;
-
-					if (op->function(op, revents))
-						op->status = pt_continuation_done;
-
-				} else if ((rv == 0) ||
-						((errno == EINTR) || (errno == EAGAIN))) {
-					if (rv == 0) {	/* select timed out */
-						if (wait_for_remaining)
-							now += remaining;
-						else
-							now += PR_MillisecondsToInterval(msecs);
-					} else
-						now = PR_IntervalNow();
-					elapsed = (PRIntervalTime) (now - epoch);
-					if (elapsed >= op->timeout) {
-						op->result.code = -1;
-						op->syserrno = ETIMEDOUT;
-						op->status = pt_continuation_done;
-					} else
-						remaining = op->timeout - elapsed;
-				} else {
-					op->result.code = -1;
-					op->syserrno = errno;
-					op->status = pt_continuation_done;
-				}
-			} while (pt_continuation_done != op->status);
-            break;
-    }
-
-}  /* pt_poll_now_with_select */
-
-#endif	/* _PR_POLL_WITH_SELECT */
-
 static void pt_poll_now(pt_Continuation *op)
 {
@@ -573,13 +409,4 @@
 
 	PR_ASSERT(PR_INTERVAL_NO_WAIT != op->timeout);
-#if defined (_PR_POLL_WITH_SELECT)
-	/*
- 	 * If the fd is small enough call the select-based poll operation
-	 */
-	if (op->arg1.osfd < FD_SETSIZE) {
-		pt_poll_now_with_select(op);
-		return;
-	}
-#endif
 
     switch (op->timeout) {
@@ -3330,324 +3157,8 @@
 } /* _pr_poll_with_poll */
 
-#if defined(_PR_POLL_WITH_SELECT)
-/*
- * OSF1 and HPUX report the POLLHUP event for a socket when the
- * shutdown(SHUT_WR) operation is called for the remote end, even though
- * the socket is still writeable. Use select(), instead of poll(), to
- * workaround this problem.
- */
-static PRInt32 _pr_poll_with_select(
-    PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
-{
-    PRInt32 ready = 0;
-    /*
-     * For restarting select() if it is interrupted by a signal.
-     * We use these variables to figure out how much time has
-     * elapsed and how much of the timeout still remains.
-     */
-    PRIntervalTime start, elapsed, remaining;
-
-    if (pt_TestAbort()) return -1;
-
-    if (0 == npds) PR_Sleep(timeout);
-    else
-    {
-#define STACK_POLL_DESC_COUNT 64
-        int stack_selectfd[STACK_POLL_DESC_COUNT];
-        int *selectfd;
-		fd_set rd, wr, ex, *rdp = NULL, *wrp = NULL, *exp = NULL;
-		struct timeval tv, *tvp;
-        PRIntn index, msecs, maxfd = 0;
-
-        if (npds <= STACK_POLL_DESC_COUNT)
-        {
-            selectfd = stack_selectfd;
-        }
-        else
-        {
-            PRThread *me = PR_GetCurrentThread();
-            if (npds > me->selectfd_count)
-            {
-                PR_Free(me->selectfd_list);
-                me->selectfd_list = (int *)PR_MALLOC(npds * sizeof(int));
-                if (NULL == me->selectfd_list)
-                {
-                    me->selectfd_count = 0;
-                    PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
-                    return -1;
-                }
-                me->selectfd_count = npds;
-            }
-            selectfd = me->selectfd_list;
-        }
-		FD_ZERO(&rd);
-		FD_ZERO(&wr);
-		FD_ZERO(&ex);
-
-        for (index = 0; index < npds; ++index)
-        {
-            PRInt16 in_flags_read = 0, in_flags_write = 0;
-            PRInt16 out_flags_read = 0, out_flags_write = 0;
-
-            if ((NULL != pds[index].fd) && (0 != pds[index].in_flags))
-            {
-                if (pds[index].in_flags & PR_POLL_READ)
-                {
-                    in_flags_read = (pds[index].fd->methods->poll)(
-                        pds[index].fd,
-                        pds[index].in_flags & ~PR_POLL_WRITE,
-                        &out_flags_read);
-                }
-                if (pds[index].in_flags & PR_POLL_WRITE)
-                {
-                    in_flags_write = (pds[index].fd->methods->poll)(
-                        pds[index].fd,
-                        pds[index].in_flags & ~PR_POLL_READ,
-                        &out_flags_write);
-                }
-                if ((0 != (in_flags_read & out_flags_read))
-                || (0 != (in_flags_write & out_flags_write)))
-                {
-                    /* this one is ready right now */
-                    if (0 == ready)
-                    {
-                        /*
-                         * We will return without calling the system
-                         * poll function.  So zero the out_flags
-                         * fields of all the poll descriptors before
-                         * this one.
-                         */
-                        int i;
-                        for (i = 0; i < index; i++)
-                        {
-                            pds[i].out_flags = 0;
-                        }
-                    }
-                    ready += 1;
-                    pds[index].out_flags = out_flags_read | out_flags_write;
-                }
-                else
-                {
-                    /* now locate the NSPR layer at the bottom of the stack */
-                    PRFileDesc *bottom = PR_GetIdentitiesLayer(
-                        pds[index].fd, PR_NSPR_IO_LAYER);
-                    PR_ASSERT(NULL != bottom);  /* what to do about that? */
-                    pds[index].out_flags = 0;  /* pre-condition */
-                    if ((NULL != bottom)
-                    && (_PR_FILEDESC_OPEN == bottom->secret->state))
-                    {
-                        if (0 == ready)
-                        {
-                            PRBool add_to_rd = PR_FALSE;
-                            PRBool add_to_wr = PR_FALSE;
-                            PRBool add_to_ex = PR_FALSE;
-
-                            selectfd[index] = bottom->secret->md.osfd;
-                            if (in_flags_read & PR_POLL_READ)
-                            {
-                                pds[index].out_flags |=
-                                    _PR_POLL_READ_SYS_READ;
-                                add_to_rd = PR_TRUE;
-                            }
-                            if (in_flags_read & PR_POLL_WRITE)
-                            {
-                                pds[index].out_flags |=
-                                    _PR_POLL_READ_SYS_WRITE;
-                                add_to_wr = PR_TRUE;
-                            }
-                            if (in_flags_write & PR_POLL_READ)
-                            {
-                                pds[index].out_flags |=
-                                    _PR_POLL_WRITE_SYS_READ;
-                                add_to_rd = PR_TRUE;
-                            }
-                            if (in_flags_write & PR_POLL_WRITE)
-                            {
-                                pds[index].out_flags |=
-                                    _PR_POLL_WRITE_SYS_WRITE;
-                                add_to_wr = PR_TRUE;
-                            }
-                            if (pds[index].in_flags & PR_POLL_EXCEPT)
-                            {
-                                add_to_ex = PR_TRUE;
-                            }
-                            if ((selectfd[index] > maxfd) &&
-                                    (add_to_rd || add_to_wr || add_to_ex))
-                            {
-                                maxfd = selectfd[index];
-                                /*
-                                 * If maxfd is too large to be used with
-                                 * select, fall back to calling poll.
-                                 */
-                                if (maxfd >= FD_SETSIZE)
-                                    break;
-                            }
-                            if (add_to_rd)
-                            {
-                                FD_SET(bottom->secret->md.osfd, &rd);
-                                rdp = &rd;
-                            }
-                            if (add_to_wr)
-                            {
-                                FD_SET(bottom->secret->md.osfd, &wr);
-                                wrp = &wr;
-                            }
-                            if (add_to_ex)
-                            {
-                                FD_SET(bottom->secret->md.osfd, &ex);
-                                exp = &ex;
-                            }
-                        }
-                    }
-                    else
-                    {
-                        if (0 == ready)
-                        {
-                            int i;
-                            for (i = 0; i < index; i++)
-                            {
-                                pds[i].out_flags = 0;
-                            }
-                        }
-                        ready += 1;  /* this will cause an abrupt return */
-                        pds[index].out_flags = PR_POLL_NVAL;  /* bogii */
-                    }
-                }
-            }
-            else
-            {
-                pds[index].out_flags = 0;
-            }
-        }
-        if (0 == ready)
-        {
-			if (maxfd >= FD_SETSIZE)
-			{
-				/*
-				 * maxfd too large to be used with select, fall back to
-				 * calling poll
-				 */
-				return(_pr_poll_with_poll(pds, npds, timeout));
-			}
-            switch (timeout)
-            {
-            case PR_INTERVAL_NO_WAIT:
-				tv.tv_sec = 0;
-				tv.tv_usec = 0;
-				tvp = &tv;
-				break;
-            case PR_INTERVAL_NO_TIMEOUT:
-				tvp = NULL;
-				break;
-            default:
-                msecs = PR_IntervalToMilliseconds(timeout);
-				tv.tv_sec = msecs/PR_MSEC_PER_SEC;
-				tv.tv_usec = (msecs % PR_MSEC_PER_SEC) * PR_USEC_PER_MSEC;
-				tvp = &tv;
-                start = PR_IntervalNow();
-            }
-
-retry:
-            ready = select(maxfd + 1, rdp, wrp, exp, tvp);
-            if (-1 == ready)
-            {
-                PRIntn oserror = errno;
-
-                if ((EINTR == oserror) || (EAGAIN == oserror))
-                {
-                    if (timeout == PR_INTERVAL_NO_TIMEOUT)
-                        goto retry;
-                    else if (timeout == PR_INTERVAL_NO_WAIT)
-                        ready = 0;  /* don't retry, just time out */
-                    else
-                    {
-                        elapsed = (PRIntervalTime) (PR_IntervalNow()
-                                - start);
-                        if (elapsed > timeout)
-                            ready = 0;  /* timed out */
-                        else
-                        {
-                            remaining = timeout - elapsed;
-                            msecs = PR_IntervalToMilliseconds(remaining);
-							tv.tv_sec = msecs/PR_MSEC_PER_SEC;
-							tv.tv_usec = (msecs % PR_MSEC_PER_SEC) *
-													PR_USEC_PER_MSEC;
-                            goto retry;
-                        }
-                    }
-                } else if (EBADF == oserror)
-                {
-					/* find all the bad fds */
-					ready = 0;
-                	for (index = 0; index < npds; ++index)
-					{
-                    	pds[index].out_flags = 0;
-            			if ((NULL != pds[index].fd) &&
-											(0 != pds[index].in_flags))
-						{
-							if (fcntl(selectfd[index], F_GETFL, 0) == -1)
-							{
-                    			pds[index].out_flags = PR_POLL_NVAL;
-								ready++;
-							}
-						}
-					}
-                } else
-                    _PR_MD_MAP_SELECT_ERROR(oserror);
-            }
-            else if (ready > 0)
-            {
-                for (index = 0; index < npds; ++index)
-                {
-                    PRInt16 out_flags = 0;
-                    if ((NULL != pds[index].fd) && (0 != pds[index].in_flags))
-                    {
-						if (FD_ISSET(selectfd[index], &rd))
-						{
-							if (pds[index].out_flags
-							& _PR_POLL_READ_SYS_READ)
-							{
-								out_flags |= PR_POLL_READ;
-							}
-							if (pds[index].out_flags
-							& _PR_POLL_WRITE_SYS_READ)
-							{
-								out_flags |= PR_POLL_WRITE;
-							}
-						}
-						if (FD_ISSET(selectfd[index], &wr))
-						{
-							if (pds[index].out_flags
-							& _PR_POLL_READ_SYS_WRITE)
-							{
-								out_flags |= PR_POLL_READ;
-							}
-							if (pds[index].out_flags
-							& _PR_POLL_WRITE_SYS_WRITE)
-							{
-								out_flags |= PR_POLL_WRITE;
-							}
-						}
-						if (FD_ISSET(selectfd[index], &ex))
-							out_flags |= PR_POLL_EXCEPT;
-                    }
-                    pds[index].out_flags = out_flags;
-                }
-            }
-        }
-    }
-    return ready;
-
-} /* _pr_poll_with_select */
-#endif	/* _PR_POLL_WITH_SELECT */
-
 PR_IMPLEMENT(PRInt32) PR_Poll(
     PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
 {
-#if defined(_PR_POLL_WITH_SELECT)
-	return(_pr_poll_with_select(pds, npds, timeout));
-#else
 	return(_pr_poll_with_poll(pds, npds, timeout));
-#endif
 }
 
Index: trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptthread.c
===================================================================
--- trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptthread.c	(revision 101812)
+++ trunk/src/libs/xpcom18a4/nsprpub/pr/src/pthreads/ptthread.c	(revision 101813)
@@ -843,8 +843,4 @@
     if (NULL != thred->syspoll_list)
         PR_Free(thred->syspoll_list);
-#if defined(_PR_POLL_WITH_SELECT)
-    if (NULL != thred->selectfd_list)
-        PR_Free(thred->selectfd_list);
-#endif
 #if defined(DEBUG)
     memset(thred, 0xaf, sizeof(PRThread));
