Re: 2.5 and delay pools

From: Adrian Chadd <adrian@dont-contact.us>
Date: Thu, 4 Mar 2004 00:49:11 -0700

On Thu, Mar 04, 2004, Adrian Chadd wrote:

> > You need to remove far more fd_set references if this is the problem.
> > There is also seveal delay pool related fd_set usage in comm_poll, and a
> > few other places I think.
>
> Ok. I must've missed them. Let me go through the codebase and remove
> all references to fd_set when you're not actually using select().

Ok, the only use I can see is in the slowfds use. The other use of
fd_set is in the select() codepath.

Here's the patch I'd like to commit:

ndex: delay_pools.c
===================================================================
RCS file: /squid/squid/src/delay_pools.c,v
retrieving revision 1.19.2.8
diff -u -r1.19.2.8 delay_pools.c
--- delay_pools.c 18 Jun 2003 23:53:35 -0000 1.19.2.8
+++ delay_pools.c 4 Mar 2004 07:47:21 -0000
@@ -89,7 +89,7 @@
 typedef union _delayPool delayPool;

 static delayPool *delay_data = NULL;
-static fd_set delay_no_delay;
+static int delay_no_delay[SQUID_MAXFD];
 static time_t delay_pools_last_update = 0;
 static hash_table *delay_id_ptr_hash = NULL;
 static long memory_used = 0;
@@ -134,7 +134,7 @@
 delayPoolsInit(void)
 {
     delay_pools_last_update = getCurrentTime();
- FD_ZERO(&delay_no_delay);
+ bzero(&delay_no_delay, sizeof(delay_no_delay));
     cachemgrRegister("delay", "Delay Pool Levels", delayPoolStats, 0, 1);
 }

@@ -283,19 +283,19 @@
 void
 delaySetNoDelay(int fd)
 {
- FD_SET(fd, &delay_no_delay);
+ delay_no_delay[fd] = 1;
 }

 void
 delayClearNoDelay(int fd)
 {
- FD_CLR(fd, &delay_no_delay);
+ delay_no_delay[fd] = 0;
 }

 int
 delayIsNoDelay(int fd)
 {
- return FD_ISSET(fd, &delay_no_delay);
+ return (delay_no_delay[fd] == 1);
 }

 static delay_id
Index: comm_select.c
===================================================================
RCS file: /squid/squid/src/comm_select.c,v
retrieving revision 1.53.2.7
diff -u -r1.53.2.7 comm_select.c
--- comm_select.c 11 May 2003 17:30:13 -0000 1.53.2.7
+++ comm_select.c 4 Mar 2004 07:47:21 -0000
@@ -310,7 +310,7 @@
 {
     struct pollfd pfds[SQUID_MAXFD];
 #if DELAY_POOLS
- fd_set slowfds;
+ char slowfds[SQUID_MAXFD];
 #endif
     PF *hdl = NULL;
     int fd;
@@ -332,7 +332,7 @@
        /* Handle any fs callbacks that need doing */
        storeDirCallback();
 #if DELAY_POOLS
- FD_ZERO(&slowfds);
+ bzero(&slowfds, sizeof(slowfds));
 #endif
        if (commCheckICPIncoming)
            comm_poll_icp_incoming();
@@ -358,7 +358,7 @@
 #if DELAY_POOLS
                case -1:
                    events |= POLLRDNORM;
- FD_SET(i, &slowfds);
+ slowfds[i] = 1;
                    break;
 #endif
                default:
@@ -437,7 +437,7 @@
                if (NULL == (hdl = F->read_handler))
                    (void) 0;
 #if DELAY_POOLS
- else if (FD_ISSET(fd, &slowfds))
+ else if (slowfds[i])
                    commAddSlowFd(fd);
 #endif
                else {
Received on Thu Mar 04 2004 - 00:49:11 MST

This archive was generated by hypermail pre-2.1.9 : Thu Apr 01 2004 - 12:00:04 MST