/*
- * $Id: cache_cf.cc,v 1.99 1996/09/24 18:50:05 wessels Exp $
+ * $Id: cache_cf.cc,v 1.100 1996/09/26 19:19:11 wessels Exp $
*
* DEBUG: section 3 Configuration File Parsing
* AUTHOR: Harvest Derived
#define DefaultIpcacheSize 1024
#define DefaultIpcacheLow 90
#define DefaultIpcacheHigh 95
-#define DefaultMaxHotvmObjSize (12<<10) /* 12k */
+#define DefaultMaxHotvmObjSize (256<<10) /* 256k */
int httpd_accel_mode = 0; /* for fast access */
char *DefaultSwapDir = DEFAULT_SWAP_DIR;
char ForwardedBy[256];
char w_space[] = " \t\n";
+char null_string[] = "";
char config_input_line[BUFSIZ];
int config_lineno = 0;
static char fatal_str[BUFSIZ];
static void configDoConfigure _PARAMS((void));
-static void configFreeMemory _PARAMS((void));
static void configSetFactoryDefaults _PARAMS((void));
static void parseAccessLogLine _PARAMS((void));
static void parseAddressLine _PARAMS((struct in_addr *));
parseFtpOptionsLine(void)
{
char *token;
- token = strtok(NULL, ""); /* Note "", don't separate these */
+ token = strtok(NULL, null_string);
if (token == NULL)
self_destruct();
safe_free(Config.Program.ftpget_opts);
parseDebugOptionsLine(void)
{
char *token;
- token = strtok(NULL, ""); /* Note "", don't separate these */
+ token = strtok(NULL, null_string);
safe_free(Config.debugOptions);
if (token == NULL) {
Config.debugOptions = NULL;
parseErrHtmlLine(void)
{
char *token;
- if ((token = strtok(NULL, "")))
+ if ((token = strtok(NULL, null_string)))
Config.errHtmlText = xstrdup(token);
}
return p ? xstrdup(p) : p;
}
-static void
+void
configFreeMemory(void)
{
safe_free(Config.Wais.relayHost);
sprintf(ForwardedBy, "Forwarded: by http://%s:%d/",
getMyHostname(), Config.Port.http);
if (Config.errHtmlText == NULL)
- Config.errHtmlText = xstrdup("");
+ Config.errHtmlText = xstrdup(null_string);
storeConfigure();
}
/*
- * $Id: comm.cc,v 1.79 1996/09/24 20:17:28 wessels Exp $
+ * $Id: comm.cc,v 1.80 1996/09/26 19:19:12 wessels Exp $
*
* DEBUG: section 5 Socket Functions
* AUTHOR: Harvest Derived
(PF) commHandleWrite,
fd_table[fd].rwstate);
}
+
+void
+commFreeMemory(void)
+{
+ safe_free(fd_table);
+}
/*
- * $Id: disk.cc,v 1.28 1996/09/20 06:28:35 wessels Exp $
+ * $Id: disk.cc,v 1.29 1996/09/26 19:19:13 wessels Exp $
*
* DEBUG: section 6 Disk I/O Routines
* AUTHOR: Harvest Derived
{
return file_table[fd].write_q ? 0 : 1;
}
+
+void
+diskFreeMemory(void)
+{
+ safe_free(file_table);
+}
/*
- * $Id: dns.cc,v 1.15 1996/09/24 20:17:28 wessels Exp $
+ * $Id: dns.cc,v 1.16 1996/09/26 19:19:14 wessels Exp $
*
* DEBUG: section 34 Dnsserver interface
* AUTHOR: Harvest Derived
void
-dnsOpenServers(void)
+dnsFreeMemory(void)
{
- int N = Config.dnsChildren;
- char *prg = Config.Program.dnsserver;
int k;
- int dnssocket;
- LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ);
-
/* free old structures if present */
if (dns_child_table) {
for (k = 0; k < NDnsServersAlloc; k++) {
}
safe_free(dns_child_table);
}
+}
+
+void
+dnsOpenServers(void)
+{
+ int N = Config.dnsChildren;
+ char *prg = Config.Program.dnsserver;
+ int k;
+ int dnssocket;
+ LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ);
+
+ dnsFreeMemory();
dns_child_table = xcalloc(N, sizeof(dnsserver_t *));
debug(34, 1, "dnsOpenServers: Starting %d 'dns_server' processes\n", N);
NDnsServersAlloc = 0;
/*
- * $Id: errorpage.cc,v 1.41 1996/09/20 06:28:37 wessels Exp $
+ * $Id: errorpage.cc,v 1.42 1996/09/26 19:19:15 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
getMyHostname());
return tmp_error_buf;
}
+
+void
+errorpageFreeMemory(void)
+{
+ safe_free(tmp_error_buf);
+ safe_free(tbuf);
+ safe_free(auth_msg);
+}
/*
- * $Id: filemap.cc,v 1.11 1996/09/20 06:28:41 wessels Exp $
+ * $Id: filemap.cc,v 1.12 1996/09/26 19:19:17 wessels Exp $
*
* DEBUG: section 8 Swap File Bitmap
* AUTHOR: Harvest Derived
return (0); /* NOTREACHED */
}
+void
+filemapFreeMemory(void)
+{
+ safe_free(fm->file_map);
+ safe_free(fm);
+}
+
#ifdef TEST
#define TEST_SIZE 1<<16
/*
- * $Id: redirect.cc,v 1.19 1996/09/20 06:29:05 wessels Exp $
+ * $Id: redirect.cc,v 1.20 1996/09/26 19:19:20 wessels Exp $
*
* DEBUG: section 29 Redirector
* AUTHOR: Duane Wessels
Enqueue(r);
}
+void
+redirectFreeMemory(void)
+{
+ int k;
+ /* free old structures if present */
+ if (redirect_child_table) {
+ for (k = 0; k < NRedirectors; k++) {
+ put_free_4k_page(redirect_child_table[k]->inbuf);
+ safe_free(redirect_child_table[k]);
+ }
+ safe_free(redirect_child_table);
+ }
+}
+
void
redirectOpenServers(void)
{
LOCAL_ARRAY(char, fd_note_buf, FD_ASCII_NOTE_SZ);
static int first_time = 0;
+ redirectFreeMemory();
if (Config.Program.redirect == NULL)
return;
- /* free old structures if present */
- if (redirect_child_table) {
- for (k = 0; k < NRedirectors; k++)
- safe_free(redirect_child_table[k]);
- safe_free(redirect_child_table);
- }
NRedirectors = NRedirectorsOpen = Config.redirectChildren;
redirect_child_table = xcalloc(NRedirectors, sizeof(redirector_t *));
debug(29, 1, "redirectOpenServers: Starting %d '%s' processes\n",
/*
- * $Id: stmem.cc,v 1.26 1996/09/20 06:29:11 wessels Exp $
+ * $Id: stmem.cc,v 1.27 1996/09/26 19:19:21 wessels Exp $
*
* DEBUG: section 19 Memory Primitives
* AUTHOR: Harvest Derived
static void *get_free_thing _PARAMS((stmem_stats * thing));
static void put_free_thing _PARAMS((stmem_stats * thing, void *p));
+static void stmemFreeThingMemory _PARAMS((stmem_stats * thing));
void
init_stack(&request_pool.free_page_stack, request_pool.max_pages);
init_stack(&mem_obj_pool.free_page_stack, mem_obj_pool.max_pages);
}
+
+static void
+stmemFreeThingMemory(stmem_stats * thing)
+{
+ void *p;
+ while (!empty_stack(&thing->free_page_stack)) {
+ p = pop(&thing->free_page_stack);
+ safe_free(p);
+ }
+}
+
+void
+stmemFreeMemory(void)
+{
+ stmemFreeThingMemory(&sm_stats);
+ stmemFreeThingMemory(&disk_stats);
+ stmemFreeThingMemory(&request_pool);
+ stmemFreeThingMemory(&mem_obj_pool);
+}
/*
- * $Id: store.cc,v 1.120 1996/09/20 23:27:00 wessels Exp $
+ * $Id: store.cc,v 1.121 1996/09/26 19:19:23 wessels Exp $
*
* DEBUG: section 20 Storeage Manager
* AUTHOR: Harvest Derived
continue;
if (e->object_len <= 0)
continue;
+ if (BIT_TEST(e->flag, RELEASE_REQUEST))
+ continue;
+ if (BIT_TEST(e->flag, KEY_PRIVATE))
+ continue;
storeSwapFullPath(e->swap_file_number, swapfilename);
x = fprintf(fp, "%08x %08x %08x %08x %9d %s\n",
(int) e->swap_file_number,
e->expires = squid_curtime + Config.negativeTtl;
BIT_SET(e->flag, ENTRY_NEGCACHED);
}
+
+void
+storeFreeMemory(void)
+{
+ StoreEntry *e;
+#ifdef THIS_IS_SLOW
+ while ((e = (StoreEntry *) storeFindFirst(store_table))) {
+ storeHashDelete(e);
+ destroy_StoreEntry(e);
+ }
+#endif
+ hashFreeMemory(store_table);
+}
/*
- * $Id: tools.cc,v 1.65 1996/09/24 20:16:42 wessels Exp $
+ * $Id: tools.cc,v 1.66 1996/09/26 19:19:24 wessels Exp $
*
* DEBUG: section 21 Misc Functions
* AUTHOR: Harvest Derived
}
storeWriteCleanLog();
PrintRusage(NULL, debug_log);
- debug(21, 0, "Squid Cache (Version %s): Exiting normally.\n",
- version_string);
storeCloseLog();
statCloseLog();
fclose(debug_log);
+ configFreeMemory();
+ diskFreeMemory();
+ storeFreeMemory();
+ commFreeMemory();
+ filemapFreeMemory();
+ dnsFreeMemory();
+ redirectFreeMemory();
+ fdstatFreeMemory();
+ errorpageFreeMemory();
+ stmemFreeMemory();
+ debug(21, 0, "Squid Cache (Version %s): Exiting normally.\n",
+ version_string);
exit(0);
}