From: wessels <> Date: Fri, 22 Nov 1996 12:07:07 +0000 (+0000) Subject: s/FD_SETSIZE|SQUID_FD_SETSIZE/SQUID_MAXFD/ X-Git-Tag: SQUID_3_0_PRE1~5439 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=431d84c57bbd5b4034dfe37c0664ca35787e08b0;p=thirdparty%2Fsquid.git s/FD_SETSIZE|SQUID_FD_SETSIZE/SQUID_MAXFD/ --- diff --git a/ChangeLog b/ChangeLog index c751eeaa60..e8d08db0a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,19 @@ - -Changes to squid-1.1.beta20 (November 13, 1996): + - Fixed setting entry->timestamp for NOT MODIFIED replies. + - Changed old HTTP/1.1 Forwarded: header to new Via:. + - Changed urlCheckRequest() to allow all FTP requests, including + PUT which should get handled by the passthrough module. + - Fixed needlessly calling storeSwapFullPath() in + storeSwapOutHandle() (Mark Treacy). + - Simplified hash linking (Mark Treacy). + - Write pid_filename by default (Markus Gyger). + - Changed "Invalid dnsserver output" to non-fatal debug_trap() + (Joe Ramey). + - Changed STORE_IN_MEM_BUCKETS to the prime 229 (Neil Murray). + +Changes to squid-1.1.beta20 (November 17, 1996): - Changed neighbor_domain_type to neighbor_type_domain in squid.conf. - - Protect squid_error_entry() calls with check that store_status - == STORE_PENDING. - Changed all 'xstrerror' debug messages to section 50. - More const fixes (Markus Gyger). - Added xstrncpy() which null-terminates (Markus Gyger). diff --git a/configure b/configure index 0be1a12152..2400945ffa 100755 --- a/configure +++ b/configure @@ -517,7 +517,7 @@ fi -# From configure.in Revision: 1.47 +# From configure.in Revision: 1.48 ac_aux_dir= for ac_dir in aux $srcdir/aux; do if test -f $ac_dir/install-sh; then @@ -2613,7 +2613,7 @@ done echo $ac_n "checking Maximum number of filedescriptors we can open""... $ac_c" 1>&6 if test "$cross_compiling" = yes; then - SQUID_FD_SETSIZE=256 + SQUID_MAXFD=256 else cat > conftest.$ac_ext </dev/null; then - SQUID_FD_SETSIZE=`cat conftestval` + SQUID_MAXFD=`cat conftestval` else - SQUID_FD_SETSIZE=256 + SQUID_MAXFD=256 fi fi rm -fr conftest* -echo "$ac_t""$SQUID_FD_SETSIZE" 1>&6 +echo "$ac_t""$SQUID_MAXFD" 1>&6 cat >> confdefs.h <> 2)) < 0) { + if ((x = listen(sock, SQUID_MAXFD >> 2)) < 0) { debug(50, 0, "comm_listen: listen(%d, %d): %s\n", - FD_SETSIZE >> 2, + SQUID_MAXFD >> 2, sock, xstrerror()); return x; } @@ -360,7 +360,7 @@ int comm_set_fd_lifetime(int fd, int lifetime) { debug(5, 3, "comm_set_fd_lifetime: FD %d lft %d\n", fd, lifetime); - if (fd < 0 || fd > FD_SETSIZE) + if (fd < 0 || fd > SQUID_MAXFD) return 0; if (lifetime < 0) return fd_lifetime[fd] = -1; @@ -520,7 +520,7 @@ comm_close(int fd) { FD_ENTRY *conn = NULL; debug(5, 5, "comm_close: FD %d\n", fd); - if (fd < 0 || fd >= FD_SETSIZE) + if (fd < 0 || fd >= SQUID_MAXFD) return; conn = &fd_table[fd]; if (!conn->openned) @@ -1008,17 +1008,17 @@ comm_init(void) { int i; - fd_table = xcalloc(FD_SETSIZE, sizeof(FD_ENTRY)); - meta_data.misc += FD_SETSIZE * sizeof(FD_ENTRY); + fd_table = xcalloc(SQUID_MAXFD, sizeof(FD_ENTRY)); + meta_data.misc += SQUID_MAXFD * sizeof(FD_ENTRY); /* Keep a few file descriptors free so that we don't run out of FD's * after accepting a client but before it opens a socket or a file. - * Since FD_SETSIZE can be as high as several thousand, don't waste them */ - RESERVED_FD = min(100, FD_SETSIZE / 4); + * Since SQUID_MAXFD can be as high as several thousand, don't waste them */ + RESERVED_FD = min(100, SQUID_MAXFD / 4); /* hardwired lifetimes */ - fd_lifetime = xmalloc(sizeof(int) * FD_SETSIZE); - for (i = 0; i < FD_SETSIZE; i++) + fd_lifetime = xmalloc(sizeof(int) * SQUID_MAXFD); + for (i = 0; i < SQUID_MAXFD; i++) comm_set_fd_lifetime(i, -1); /* denotes invalid */ - meta_data.misc += FD_SETSIZE * sizeof(int); + meta_data.misc += SQUID_MAXFD * sizeof(int); zero_tv.tv_sec = 0; zero_tv.tv_usec = 0; return 0; @@ -1048,7 +1048,7 @@ examine_select(fd_set * readfds, fd_set * writefds) FD_ENTRY *f = NULL; debug(5, 0, "examine_select: Examining open file descriptors...\n"); - for (fd = 0; fd < FD_SETSIZE; fd++) { + for (fd = 0; fd < SQUID_MAXFD; fd++) { FD_ZERO(&read_x); FD_ZERO(&write_x); tv.tv_sec = tv.tv_usec = 0; @@ -1058,7 +1058,7 @@ examine_select(fd_set * readfds, fd_set * writefds) FD_SET(fd, &write_x); else continue; - num = select(FD_SETSIZE, &read_x, &write_x, NULL, &tv); + num = select(SQUID_MAXFD, &read_x, &write_x, NULL, &tv); if (num > -1) { debug(5, 5, "FD %d is valid.\n", fd); continue; @@ -1115,7 +1115,7 @@ checkTimeouts(void) FD_ENTRY *f = NULL; void *data; /* scan for timeout */ - for (fd = 0; fd < FD_SETSIZE; ++fd) { + for (fd = 0; fd < SQUID_MAXFD; ++fd) { f = &fd_table[fd]; if ((hdl = f->timeout_handler) == NULL) continue; @@ -1138,7 +1138,7 @@ checkLifetimes(void) PF hdl = NULL; - for (fd = 0; fd < FD_SETSIZE; fd++) { + for (fd = 0; fd < SQUID_MAXFD; fd++) { if ((lft = comm_get_fd_lifetime(fd)) == -1) continue; if (lft > squid_curtime) @@ -1177,12 +1177,12 @@ checkLifetimes(void) static void Reserve_More_FDs(void) { - if (RESERVED_FD < FD_SETSIZE - 64) { + if (RESERVED_FD < SQUID_MAXFD - 64) { RESERVED_FD = RESERVED_FD + 1; - } else if (RESERVED_FD == FD_SETSIZE - 64) { + } else if (RESERVED_FD == SQUID_MAXFD - 64) { RESERVED_FD = RESERVED_FD + 1; debug(5, 0, "Don't you have a tiny open-file table size of %d\n", - FD_SETSIZE - RESERVED_FD); + SQUID_MAXFD - RESERVED_FD); } } diff --git a/src/disk.cc b/src/disk.cc index 490b1ed1c1..aef7b796de 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,5 +1,5 @@ /* - * $Id: disk.cc,v 1.43 1996/11/15 00:36:17 wessels Exp $ + * $Id: disk.cc,v 1.44 1996/11/22 05:07:12 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -131,9 +131,9 @@ disk_init(void) { int fd; - file_table = xcalloc(FD_SETSIZE, sizeof(FileEntry)); - meta_data.misc += FD_SETSIZE * sizeof(FileEntry); - for (fd = 0; fd < FD_SETSIZE; fd++) { + file_table = xcalloc(SQUID_MAXFD, sizeof(FileEntry)); + meta_data.misc += SQUID_MAXFD * sizeof(FileEntry); + for (fd = 0; fd < SQUID_MAXFD; fd++) { file_table[fd].filename[0] = '\0'; file_table[fd].at_eof = NO; file_table[fd].open_stat = FILE_NOT_OPEN; diff --git a/src/ftp.cc b/src/ftp.cc index 0e16bd0c13..e8df9b17f6 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.84 1996/11/15 17:26:19 wessels Exp $ + * $Id: ftp.cc,v 1.85 1996/11/22 05:07:13 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -728,7 +728,7 @@ ftpInitialize(void) return -1; } ftpget_port = ntohs(S.sin_port); - listen(cfd, FD_SETSIZE >> 2); + listen(cfd, SQUID_MAXFD >> 2); if ((pid = fork()) < 0) { debug(50, 0, "ftpInitialize: fork: %s\n", xstrerror()); comm_close(cfd); diff --git a/src/main.cc b/src/main.cc index 81b8872415..4ff1270184 100644 --- a/src/main.cc +++ b/src/main.cc @@ -1,5 +1,5 @@ /* - * $Id: main.cc,v 1.114 1996/11/15 00:36:21 wessels Exp $ + * $Id: main.cc,v 1.115 1996/11/22 05:07:14 wessels Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -494,7 +494,7 @@ mainInitialize(void) debug(1, 0, "Starting Squid Cache version %s for %s...\n", version_string, CONFIG_HOST_TYPE); - debug(1, 1, "With %d file descriptors available\n", FD_SETSIZE); + debug(1, 1, "With %d file descriptors available\n", SQUID_MAXFD); if (first_time) { stmemInit(); /* stmem must go before at least redirect */ @@ -599,7 +599,7 @@ main(int argc, char **argv) setMaxFD(); if (opt_catch_signals) - for (n = FD_SETSIZE; n > 2; n--) + for (n = SQUID_MAXFD; n > 2; n--) close(n); /*init comm module */ diff --git a/src/squid.h b/src/squid.h index 5ee1b93351..a4204c90b6 100644 --- a/src/squid.h +++ b/src/squid.h @@ -1,6 +1,6 @@ /* - * $Id: squid.h,v 1.74 1996/11/12 22:37:16 wessels Exp $ + * $Id: squid.h,v 1.75 1996/11/22 05:07:15 wessels Exp $ * * AUTHOR: Duane Wessels * @@ -33,10 +33,6 @@ #include "config.h" -#if SQUID_FD_SETSIZE > 256 -#define FD_SETSIZE SQUID_FD_SETSIZE -#endif - #if HAVE_UNISTD_H #include #endif diff --git a/src/stat.cc b/src/stat.cc index e9e3dca185..8b538e34a0 100644 --- a/src/stat.cc +++ b/src/stat.cc @@ -1,6 +1,6 @@ /* - * $Id: stat.cc,v 1.105 1996/11/15 00:36:22 wessels Exp $ + * $Id: stat.cc,v 1.106 1996/11/22 05:07:15 wessels Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -643,7 +643,7 @@ statFiledescriptors(StoreEntry * sentry) "Remote Address", "Description"); storeAppendPrintf(sentry, "{---- ------ ---- ---- --------------------- ------------------------------}\n"); - for (i = 0; i < FD_SETSIZE; i++) { + for (i = 0; i < SQUID_MAXFD; i++) { if (!fdstat_isopen(i)) continue; j = fdstatGetType(i); @@ -825,7 +825,7 @@ info_get(const cacheinfo * obj, StoreEntry * sentry) storeAppendPrintf(sentry, "{File descriptor usage for %s:}\n", appname); storeAppendPrintf(sentry, "{\tMax number of file desc available: %4d}\n", - FD_SETSIZE); + SQUID_MAXFD); storeAppendPrintf(sentry, "{\tLargest file desc currently in use: %4d}\n", fdstat_biggest_fd()); storeAppendPrintf(sentry, "{\tAvailable number of file descriptors: %4d}\n", diff --git a/src/stmem.cc b/src/stmem.cc index ccf7c5cf60..b3b1d98e17 100644 --- a/src/stmem.cc +++ b/src/stmem.cc @@ -1,6 +1,6 @@ /* - * $Id: stmem.cc,v 1.33 1996/11/06 23:14:59 wessels Exp $ + * $Id: stmem.cc,v 1.34 1996/11/22 05:07:16 wessels Exp $ * * DEBUG: section 19 Memory Primitives * AUTHOR: Harvest Derived @@ -421,12 +421,12 @@ stmemInit(void) request_pool.page_size = sizeof(request_t); request_pool.total_pages_allocated = 0; request_pool.n_pages_in_use = 0; - request_pool.max_pages = FD_SETSIZE >> 3; + request_pool.max_pages = SQUID_MAXFD >> 3; mem_obj_pool.page_size = sizeof(MemObject); mem_obj_pool.total_pages_allocated = 0; mem_obj_pool.n_pages_in_use = 0; - mem_obj_pool.max_pages = FD_SETSIZE >> 3; + mem_obj_pool.max_pages = SQUID_MAXFD >> 3; #if PURIFY debug(19, 0, "Disabling stacks under purify\n"); diff --git a/src/tools.cc b/src/tools.cc index 9987f293f5..d2268884e1 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.84 1996/11/19 07:21:15 wessels Exp $ + * $Id: tools.cc,v 1.85 1996/11/22 05:07:17 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -584,7 +584,7 @@ setMaxFD(void) if (getrlimit(RLIMIT_NOFILE, &rl) < 0) { debug(50, 0, "setrlimit: RLIMIT_NOFILE: %s\n", xstrerror()); } else { - rl.rlim_cur = FD_SETSIZE; + rl.rlim_cur = SQUID_MAXFD; if (rl.rlim_cur > rl.rlim_max) rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_NOFILE, &rl) < 0) { @@ -596,7 +596,7 @@ setMaxFD(void) if (getrlimit(RLIMIT_OFILE, &rl) < 0) { debug(50, 0, "setrlimit: RLIMIT_NOFILE: %s\n", xstrerror()); } else { - rl.rlim_cur = FD_SETSIZE; + rl.rlim_cur = SQUID_MAXFD; if (rl.rlim_cur > rl.rlim_max) rl.rlim_cur = rl.rlim_max; if (setrlimit(RLIMIT_OFILE, &rl) < 0) {