/*
- * $Id: access_log.cc,v 1.63 2000/12/17 13:27:37 hno Exp $
+ * $Id: access_log.cc,v 1.64 2001/01/02 00:09:55 wessels Exp $
*
* DEBUG: section 46 Access Log
* AUTHOR: Duane Wessels
accessLogInit(void)
{
assert(sizeof(log_tags) == (LOG_TYPE_MAX + 1) * sizeof(char *));
- if (strcasecmp (Config.Log.access, "none") == 0)
+ if (strcasecmp(Config.Log.access, "none") == 0)
return;
logfile = logfileOpen(Config.Log.access, MAX_URL << 1, 1);
LogfileStatus = LOG_ENABLE;
/*
- * $Id: acl.cc,v 1.227 2001/01/01 22:03:55 wessels Exp $
+ * $Id: acl.cc,v 1.228 2001/01/02 00:09:55 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
checklist->auth_user->passwd_ok = 1;
else {
if (strlen(result) > sizeof("ERR "))
- checklist->auth_user->message = xstrdup(result+4);
+ checklist->auth_user->message = xstrdup(result + 4);
checklist->auth_user->passwd_ok = 0;
}
aclCheck(checklist);
/*
- * $Id: client_side.cc,v 1.518 2000/12/17 07:18:56 hno Exp $
+ * $Id: client_side.cc,v 1.519 2001/01/02 00:09:55 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
* Now knows about IE 5.5 fix (is actually only fixed in SP1,
* but we can't tell whether we are talking to SP1 or not so
* all 5.5 versions are treated 'normally').
- */
+ */
if (Config.onoff.ie_refresh) {
- if (http->flags.accel && request->flags.ims) {
- if ( (str = httpHeaderGetStr(req_hdr, HDR_USER_AGENT)) ) {
- if (strstr(str, "MSIE 5.01") != NULL)
- no_cache++;
- else if (strstr(str, "MSIE 5.0") != NULL)
- no_cache++;
- else if (strstr(str, "MSIE 4.") != NULL)
- no_cache++;
- else if (strstr(str, "MSIE 3.") != NULL)
- no_cache++;
- }
- }
+ if (http->flags.accel && request->flags.ims) {
+ if ((str = httpHeaderGetStr(req_hdr, HDR_USER_AGENT))) {
+ if (strstr(str, "MSIE 5.01") != NULL)
+ no_cache++;
+ else if (strstr(str, "MSIE 5.0") != NULL)
+ no_cache++;
+ else if (strstr(str, "MSIE 4.") != NULL)
+ no_cache++;
+ else if (strstr(str, "MSIE 3.") != NULL)
+ no_cache++;
+ }
+ }
}
-
if (no_cache) {
#if HTTP_VIOLATIONS
if (Config.onoff.reload_into_ims)
vport, url);
#else
#if LINUX_NETFILTER
- /* If the call fails the address structure will be unchanged */
- getsockopt(conn->fd, SOL_IP, SO_ORIGINAL_DST, &conn->me, &sock_sz );
- debug(33, 5) ("parseHttpRequest: addr = %s", inet_ntoa(conn->me.sin_addr) );
+ /* If the call fails the address structure will be unchanged */
+ getsockopt(conn->fd, SOL_IP, SO_ORIGINAL_DST, &conn->me, &sock_sz);
+ debug(33, 5) ("parseHttpRequest: addr = %s", inet_ntoa(conn->me.sin_addr));
#endif
snprintf(http->uri, url_sz, "http://%s:%d%s",
inet_ntoa(http->conn->me.sin_addr),
/*
- * $Id: aiops.cc,v 1.5 2000/12/09 04:43:30 wessels Exp $
+ * $Id: aiops.cc,v 1.6 2001/01/02 00:11:51 wessels Exp $
*
* DEBUG: section 43 AIOPS
* AUTHOR: Stewart Forster <slf@connect.com.au>
typedef struct aio_request_queue_t {
pthread_mutex_t mutex;
pthread_cond_t cond;
- aio_request_t * volatile head;
- aio_request_t * volatile * volatile tailp;
+ aio_request_t *volatile head;
+ aio_request_t *volatile *volatile tailp;
unsigned long requests;
- unsigned long blocked; /* main failed to lock the queue */
+ unsigned long blocked; /* main failed to lock the queue */
} aio_request_queue_t;
typedef struct aio_thread_t aio_thread_t;
#define AIO_TINY_BUFS AIO_LARGE_BUFS >> 3
#define AIO_MICRO_BUFS 128
-static MemPool *aio_large_bufs = NULL; /* 16K */
+static MemPool *aio_large_bufs = NULL; /* 16K */
static MemPool *aio_medium_bufs = NULL; /* 8K */
-static MemPool *aio_small_bufs = NULL; /* 4K */
-static MemPool *aio_tiny_bufs = NULL; /* 2K */
-static MemPool *aio_micro_bufs = NULL; /* 128K */
+static MemPool *aio_small_bufs = NULL; /* 4K */
+static MemPool *aio_tiny_bufs = NULL; /* 2K */
+static MemPool *aio_micro_bufs = NULL; /* 128K */
static int request_queue_len = 0;
static MemPool *aio_request_pool = NULL;
static MemPool *aio_thread_pool = NULL;
static aio_request_queue_t request_queue;
-static struct { aio_request_t *head, **tailp; } request_queue2 = { NULL, &request_queue2.head };
+static struct {
+ aio_request_t *head, **tailp;
+} request_queue2 = {
+
+ NULL, &request_queue2.head
+};
static aio_request_queue_t done_queue;
-static struct { aio_request_t *head, **tailp; } done_requests = { NULL, &done_requests.head };
+static struct {
+ aio_request_t *head, **tailp;
+} done_requests = {
+
+ NULL, &done_requests.head
+};
static pthread_attr_t globattr;
static struct sched_param globsched;
static pthread_t main_thread;
{
MemPool *p;
if (size <= AIO_LARGE_BUFS) {
- if (size <= AIO_MICRO_BUFS)
- p = aio_micro_bufs;
+ if (size <= AIO_MICRO_BUFS)
+ p = aio_micro_bufs;
else if (size <= AIO_TINY_BUFS)
- p = aio_tiny_bufs;
- else if (size <= AIO_SMALL_BUFS)
- p = aio_small_bufs;
- else if (size <= AIO_MEDIUM_BUFS)
- p = aio_medium_bufs;
- else
- p = aio_large_bufs;
+ p = aio_tiny_bufs;
+ else if (size <= AIO_SMALL_BUFS)
+ p = aio_small_bufs;
+ else if (size <= AIO_MEDIUM_BUFS)
+ p = aio_medium_bufs;
+ else
+ p = aio_large_bufs;
} else
p = NULL;
return p;
void *p;
MemPool *pool;
- if ( (pool = aio_get_pool(size)) != NULL) {
+ if ((pool = aio_get_pool(size)) != NULL) {
p = memPoolAlloc(pool);
} else
p = xmalloc(size);
aio_xstrdup(const char *str)
{
char *p;
- int len = strlen(str)+1;
+ int len = strlen(str) + 1;
p = aio_xmalloc(len);
strncpy(p, str, len);
{
MemPool *pool;
- if ( (pool = aio_get_pool(size)) != NULL) {
- memPoolFree(pool, p);
+ if ((pool = aio_get_pool(size)) != NULL) {
+ memPoolFree(pool, p);
} else
- xfree(p);
+ xfree(p);
}
static void
aio_xstrfree(char *str)
{
MemPool *pool;
- int len = strlen(str)+1;
+ int len = strlen(str) + 1;
- if ( (pool = aio_get_pool(len)) != NULL) {
- memPoolFree(pool, str);
+ if ((pool = aio_get_pool(len)) != NULL) {
+ memPoolFree(pool, str);
} else
- xfree(str);
+ xfree(str);
}
static void
threadp->current_req = request = NULL;
request = NULL;
/* Get a request to process */
- threadp->status = _THREAD_WAITING;
+ threadp->status = _THREAD_WAITING;
pthread_mutex_lock(&request_queue.mutex);
- while(!request_queue.head) {
+ while (!request_queue.head) {
pthread_cond_wait(&request_queue.cond, &request_queue.mutex);
}
request = request_queue.head;
if (request)
request_queue.head = request->next;
- if (!request_queue.head)
- request_queue.tailp = &request_queue.head;
+ if (!request_queue.head)
+ request_queue.tailp = &request_queue.head;
pthread_mutex_unlock(&request_queue.mutex);
/* process the request */
threadp->status = _THREAD_BUSY;
{
static int high_start = 0;
debug(41, 9) ("aio_queue_request: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ request, request->request_type, request->resultp);
/* Mark it as not executed (failing result, no error) */
request->ret = -1;
request->err = 0;
request_queue.tailp = &request->next;
pthread_cond_signal(&request_queue.cond);
pthread_mutex_unlock(&request_queue.mutex);
- } else {
+ } else {
/* Oops, the request queue is blocked, use request_queue2 */
*request_queue2.tailp = request;
request_queue2.tailp = &request->next;
- }
+ }
} else {
/* Secondary path. We have blocked requests to deal with */
/* add the request to the chain */
debug(43, 1) ("aio_queue_request: WARNING - Disk I/O overloading\n");
if (squid_curtime >= (high_start + 15))
debug(43, 1) ("aio_queue_request: Queue Length: current=%d, high=%d, low=%d, duration=%d\n",
- request_queue_len, queue_high, queue_low, squid_curtime - high_start);
+ request_queue_len, queue_high, queue_low, squid_curtime - high_start);
last_warn = squid_curtime;
}
} else {
if (request && request->resultp == resultp) {
debug(41, 9) ("aio_cancel: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ request, request->request_type, request->resultp);
request->cancelled = 1;
request->resultp = NULL;
resultp->_data = NULL;
return NULL;
}
debug(41, 9) ("aio_poll_done: %p type=%d result=%p\n",
- request, request->request_type, request->resultp);
+ request, request->request_type, request->resultp);
done_requests.head = request->next;
if (!done_requests.head)
done_requests.tailp = &done_requests.head;
/*
- * $Id: async_io.cc,v 1.6 2000/11/10 21:42:03 hno Exp $
+ * $Id: async_io.cc,v 1.7 2001/01/02 00:11:51 wessels Exp $
*
* DEBUG: section 32 Asynchronous Disk I/O
* AUTHOR: Pete Bentley <pete@demon.net>
AIOCB *done_handler;
void *their_data;
int retval = 0;
-
+
assert(initialised);
aio_counts.check_callback++;
for (;;) {
if ((resultp = aio_poll_done()) == NULL)
break;
- ctrlp = (aio_ctrl_t *)resultp->data;
+ ctrlp = (aio_ctrl_t *) resultp->data;
if (ctrlp == NULL)
- continue; /* XXX Should not happen */
+ continue; /* XXX Should not happen */
dlinkDelete(&ctrlp->node, &used_list);
if ((done_handler = ctrlp->done_handler)) {
their_data = ctrlp->done_handler_data;
ctrlp->done_handler = NULL;
ctrlp->done_handler_data = NULL;
if (cbdataValid(their_data)) {
- retval = 1; /* Return that we've actually done some work */
+ retval = 1; /* Return that we've actually done some work */
done_handler(ctrlp->fd, their_data,
ctrlp->result.aio_return, ctrlp->result.aio_errno);
}
struct _aio_result_t {
int aio_return;
int aio_errno;
- void *_data; /* Internal housekeeping */
- void *data; /* Available to the caller */
+ void *_data; /* Internal housekeeping */
+ void *data; /* Available to the caller */
};
typedef struct _aio_result_t aio_result_t;
errflag = DISK_OK;
#else
if (errflag == DISK_EOF)
- errflag = DISK_OK; /* EOF is signalled by len == 0, not errors... */
+ errflag = DISK_OK; /* EOF is signalled by len == 0, not errors... */
#endif
assert(callback);
assert(their_data);
extern off_t storeCossAllocate(SwapDir * SD, const StoreEntry * e, int which);
extern void storeCossAdd(SwapDir *, StoreEntry *);
extern void storeCossRemove(SwapDir *, StoreEntry *);
-extern void storeCossStartMembuf(SwapDir *SD);
+extern void storeCossStartMembuf(SwapDir * SD);
#endif
/*
- * $Id: store_io_coss.cc,v 1.4 2000/06/08 18:05:38 hno Exp $
+ * $Id: store_io_coss.cc,v 1.5 2001/01/02 00:11:54 wessels Exp $
*
* DEBUG: section 81 Storage Manager COSS Interface
* AUTHOR: Eric Stern
int end;
if (!cs->membufs)
return;
- for (t=cs->membufs; t; t = t->next) {
+ for (t = cs->membufs; t; t = t->next) {
if (t->flags.writing)
sleep(5);
lseek(cs->fd, t->diskstart, SEEK_SET);
* Creates the initial membuf after rebuild
*/
void
-storeCossStartMembuf(SwapDir *sd)
+storeCossStartMembuf(SwapDir * sd)
{
CossInfo *cs = (CossInfo *) sd->fsdata;
CossMemBuf *newmb = storeCossCreateMemBuf(sd, cs->current_offset, -1, NULL);
/*
- * $Id: store_io_diskd.cc,v 1.17 2000/11/27 00:03:33 adrian Exp $
+ * $Id: store_io_diskd.cc,v 1.18 2001/01/02 00:11:54 wessels Exp $
*
* DEBUG: section 81 Squid-side DISKD I/O functions.
* AUTHOR: Duane Wessels
sio->read.callback = NULL;
sio->read.callback_data = NULL;
if (valid) {
- assert(!diskdstate->flags.close_request);
- /*
- * Only copy the data if the callback is still valid,
- * if it isn't valid then the request should have been
- * aborted.
- * -- adrian
- */
- xmemcpy(their_buf, sbuf, len); /* yucky copy */
+ assert(!diskdstate->flags.close_request);
+ /*
+ * Only copy the data if the callback is still valid,
+ * if it isn't valid then the request should have been
+ * aborted.
+ * -- adrian
+ */
+ xmemcpy(their_buf, sbuf, len); /* yucky copy */
callback(their_data, their_buf, len);
}
}
/*
- * $Id: store_dir_ufs.cc,v 1.19 2000/12/09 01:47:23 wessels Exp $
+ * $Id: store_dir_ufs.cc,v 1.20 2001/01/02 00:11:55 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
/* load new */
(void) 0;
}
- /* update store_swap_size */
- rb->counts.objcount++;
- e = storeUfsDirAddDiskRestore(SD, s.key,
- s.swap_filen,
- s.swap_file_sz,
- s.expires,
- s.timestamp,
- s.lastref,
- s.lastmod,
- s.refcount,
- s.flags,
- (int) rb->flags.clean);
- storeDirSwapLog(e, SWAP_LOG_ADD);
+ /* update store_swap_size */
+ rb->counts.objcount++;
+ e = storeUfsDirAddDiskRestore(SD, s.key,
+ s.swap_filen,
+ s.swap_file_sz,
+ s.expires,
+ s.timestamp,
+ s.lastref,
+ s.lastmod,
+ s.refcount,
+ s.flags,
+ (int) rb->flags.clean);
+ storeDirSwapLog(e, SWAP_LOG_ADD);
}
eventAdd("storeRebuild", storeUfsDirRebuildFromSwapLog, rb, 0.0, 1);
}
/*
- * $Id: store_heap_replacement.cc,v 1.3 2000/11/03 16:39:42 wessels Exp $
+ * $Id: store_heap_replacement.cc,v 1.4 2001/01/02 00:11:55 wessels Exp $
*
* DEBUG: section 20 Storage Manager Heap-based replacement
* AUTHOR: John Dilley
* for this to become a problem. (estimation is 10^8 cache
* turnarounds)
*/
-heap_key
+heap_key
HeapKeyGen_StoreEntry_LFUDA(void *entry, double age)
{
StoreEntry *e = entry;
* for this to become a problem. (estimation is 10^8 cache
* turnarounds)
*/
-heap_key
+heap_key
HeapKeyGen_StoreEntry_GDSF(void *entry, double age)
{
StoreEntry *e = entry;
* Don't use it unless you are trying to compare performance among
* heap-based replacement policies...
*/
-heap_key
+heap_key
HeapKeyGen_StoreEntry_LRU(void *entry, double age)
{
StoreEntry *e = entry;
/*
- * $Id: store.cc,v 1.534 2000/12/17 08:54:02 hno Exp $
+ * $Id: store.cc,v 1.535 2001/01/02 00:09:56 wessels Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
debug(20, 1) ("ERROR: Be sure to have set cache_replacement_policy\n");
debug(20, 1) ("ERROR: and memory_replacement_policy in squid.conf!\n");
fatalf("ERROR: Unknown policy %s\n", settings->type);
- return NULL; /* NOTREACHED */
+ return NULL; /* NOTREACHED */
}
#if 0