dnl Configuration input file for Squid
dnl
-dnl $Id: configure.in,v 1.448 2007/04/07 09:35:37 serassio Exp $
+dnl $Id: configure.in,v 1.449 2007/04/12 23:51:55 wessels Exp $
dnl
dnl
dnl
AC_CONFIG_AUX_DIR(cfgaux)
AC_CONFIG_SRCDIR([src/main.cc])
AM_INIT_AUTOMAKE([tar-ustar])
-AC_REVISION($Revision: 1.448 $)dnl
+AC_REVISION($Revision: 1.449 $)dnl
AC_PREFIX_DEFAULT(/usr/local/squid)
AM_MAINTAINER_MODE
AM_CONDITIONAL(USE_DNSSERVER, true)
fi
-AC_ARG_ENABLE(truncate,
-[ --enable-truncate This uses truncate() instead of unlink() when
- removing cache files. Truncate gives a little
- performance improvement, but may cause problems
- when used with async I/O. Truncate uses more
- filesystem inodes than unlink..],
-[ if test "$enableval" = "yes" ; then
- echo "Enabling truncate instead of unlink"
- AC_DEFINE(USE_TRUNCATE,1,[Do we want to use truncate(2) or unlink(2)?])
- fi
-])
-
dnl Select Default hosts file location
AC_ARG_ENABLE(default-hostsfile,
[ --enable-default-hostsfile=path
/* Define this to include code for SSL encryption. */
#undef USE_SSL
-/* Do we want to use truncate(2) or unlink(2)? */
-#undef USE_TRUNCATE
-
/* Define this if unlinkd is required (strongly recommended for ufs storage
type) */
#undef USE_UNLINKD
/*
- * $Id: BlockingIOStrategy.cc,v 1.1 2004/12/20 16:30:38 robertc Exp $
+ * $Id: BlockingIOStrategy.cc,v 1.2 2007/04/12 23:51:56 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Robert Collins
{
#if USE_UNLINKD
unlinkdUnlink(path);
-#elif USE_TRUNCATE
-
- truncate(path, 0);
#else
-
::unlink(path);
#endif
}
/*
- * $Id: DiskdIOStrategy.cc,v 1.8 2007/04/12 17:56:39 rousskov Exp $
+ * $Id: DiskdIOStrategy.cc,v 1.9 2007/04/12 23:51:57 wessels Exp $
*
* DEBUG: section 79 Squid-side DISKD I/O functions.
* AUTHOR: Duane Wessels
#if USE_UNLINKD
unlinkdUnlink(path);
-#elif USE_TRUNCATE
-
- truncate(path, 0);
#else
unlink(path);
/*
- * $Id: diskd.cc,v 1.5 2007/04/07 16:29:06 serassio Exp $
+ * $Id: diskd.cc,v 1.6 2007/04/12 23:51:57 wessels Exp $
*
* DEBUG: section -- External DISKD process implementation.
* AUTHOR: Harvest Derived
static int
do_unlink(diomsg * r, int len, const char *buf)
{
-#if USE_TRUNCATE
-
- if (truncate(buf, 0) < 0)
-#else
-
- if (unlink(buf) < 0)
-#endif
-
- {
+ if (unlink(buf) < 0) {
DEBUG(1) {
fprintf(stderr, "%d UNLNK id %d %s: ", (int) mypid, r->id, buf);
-#if USE_TRUNCATE
-
- perror("truncate");
-#else
-
perror("unlink");
-#endif
-
}
return -errno;
_AIO_OP_WRITE,
_AIO_OP_CLOSE,
_AIO_OP_UNLINK,
- _AIO_OP_TRUNCATE,
_AIO_OP_OPENDIR,
_AIO_OP_STAT
};
int squidaio_stat(const char *, struct stat *, squidaio_result_t *);
int squidaio_unlink(const char *, squidaio_result_t *);
-int squidaio_truncate(const char *, off_t length, squidaio_result_t *);
int squidaio_opendir(const char *, squidaio_result_t *);
squidaio_result_t *squidaio_poll_done(void);
int squidaio_operations_pending(void);
void aioStat(char *, struct stat *, AIOCB *, void *);
void aioUnlink(const char *, AIOCB *, void *);
-void aioTruncate(const char *, off_t length, AIOCB *, void *);
int aioQueueSize(void);
#include "DiskIO/DiskFile.h"
/*
- * $Id: DiskThreadsIOStrategy.cc,v 1.10 2006/11/25 20:12:38 serassio Exp $
+ * $Id: DiskThreadsIOStrategy.cc,v 1.11 2007/04/12 23:51:57 wessels Exp $
*
* DEBUG: section 79 Squid-side Disk I/O functions.
* AUTHOR: Robert Collins
case _AIO_OP_NONE:
- case _AIO_OP_TRUNCATE:
-
case _AIO_OP_OPENDIR:
break;
DiskThreadsIOStrategy::unlinkFile(char const *path)
{
statCounter.syscalls.disk.unlinks++;
-#if USE_TRUNCATE
-
- aioTruncate(path, 0, NULL, NULL);
-#else
-
aioUnlink(path, NULL, NULL);
-#endif
}
/*
- * $Id: DiskThreadsIOStrategy.h,v 1.4 2006/09/03 04:12:00 hno Exp $
+ * $Id: DiskThreadsIOStrategy.h,v 1.5 2007/04/12 23:51:57 wessels Exp $
*
* DEBUG: section 79 Squid-side Disk I/O functions.
* AUTHOR: Robert Collins
#define _AIO_WRITE 2
#define _AIO_CLOSE 3
#define _AIO_UNLINK 4
-#define _AIO_TRUNCATE 4
#define _AIO_OPENDIR 5
#define _AIO_STAT 6
#include "DiskIO/DiskIOStrategy.h"
/*
- * $Id: aiops.cc,v 1.12 2006/09/03 21:05:20 hno Exp $
+ * $Id: aiops.cc,v 1.13 2007/04/12 23:51:57 wessels Exp $
*
* DEBUG: section 43 AIOPS
* AUTHOR: Stewart Forster <slf@connect.com.au>
static void squidaio_do_write(squidaio_request_t *);
static void squidaio_do_close(squidaio_request_t *);
static void squidaio_do_stat(squidaio_request_t *);
-#if USE_TRUNCATE
-static void squidaio_do_truncate(squidaio_request_t *);
-#else
static void squidaio_do_unlink(squidaio_request_t *);
-#endif
#if AIO_OPENDIR
static void *squidaio_do_opendir(squidaio_request_t *);
#endif
squidaio_do_close(request);
break;
-#if USE_TRUNCATE
-
- case _AIO_OP_TRUNCATE:
- squidaio_do_truncate(request);
- break;
-#else
-
case _AIO_OP_UNLINK:
squidaio_do_unlink(request);
break;
-#endif
#if AIO_OPENDIR /* Opendir not implemented yet */
case _AIO_OP_OPENDIR:
case _AIO_OP_UNLINK:
- case _AIO_OP_TRUNCATE:
-
case _AIO_OP_OPENDIR:
squidaio_xstrfree(requestp->path);
}
-#if USE_TRUNCATE
-int
-squidaio_truncate(const char *path, off_t length, squidaio_result_t * resultp)
-{
- squidaio_init();
- squidaio_request_t *requestp;
-
- requestp = (squidaio_request_t *)squidaio_request_pool->alloc();
-
- requestp->path = (char *) squidaio_xstrdup(path);
-
- requestp->offset = length;
-
- requestp->resultp = resultp;
-
- requestp->request_type = _AIO_OP_TRUNCATE;
-
- requestp->cancelled = 0;
-
- resultp->result_type = _AIO_OP_TRUNCATE;
-
- squidaio_queue_request(requestp);
-
- return 0;
-}
-
-
-static void
-squidaio_do_truncate(squidaio_request_t * requestp)
-{
- requestp->ret = truncate(requestp->path, requestp->offset);
- requestp->err = errno;
-}
-
-
-#else
int
squidaio_unlink(const char *path, squidaio_result_t * resultp)
{
requestp->err = errno;
}
-#endif
-
#if AIO_OPENDIR
/* XXX squidaio_opendir NOT implemented yet.. */
debug(43, 5) ("UNLINK of %s\n", request->path);
break;
- case _AIO_OP_TRUNCATE:
- debug(43, 5) ("UNLINK of %s\n", request->path);
- break;
-
default:
break;
}
/*
- * $Id: aiops_win32.cc,v 1.2 2006/09/09 15:29:59 serassio Exp $
+ * $Id: aiops_win32.cc,v 1.3 2007/04/12 23:51:57 wessels Exp $
*
* DEBUG: section 43 Windows AIOPS
* AUTHOR: Stewart Forster <slf@connect.com.au>
static void squidaio_do_write(squidaio_request_t *);
static void squidaio_do_close(squidaio_request_t *);
static void squidaio_do_stat(squidaio_request_t *);
-#if USE_TRUNCATE
-static void squidaio_do_truncate(squidaio_request_t *);
-#else
static void squidaio_do_unlink(squidaio_request_t *);
-#endif
#if AIO_OPENDIR
static void *squidaio_do_opendir(squidaio_request_t *);
#endif
squidaio_do_close(request);
break;
-#if USE_TRUNCATE
-
- case _AIO_OP_TRUNCATE:
- squidaio_do_truncate(request);
- break;
-#else
-
case _AIO_OP_UNLINK:
squidaio_do_unlink(request);
break;
-#endif
#if AIO_OPENDIR /* Opendir not implemented yet */
case _AIO_OP_OPENDIR:
case _AIO_OP_UNLINK:
- case _AIO_OP_TRUNCATE:
-
case _AIO_OP_OPENDIR:
squidaio_xstrfree(requestp->path);
}
-#if USE_TRUNCATE
-int
-squidaio_truncate(const char *path, off_t length, squidaio_result_t * resultp)
-{
- squidaio_init();
- squidaio_request_t *requestp;
-
- requestp = (squidaio_request_t *)squidaio_request_pool->alloc();
-
- requestp->path = (char *) squidaio_xstrdup(path);
-
- requestp->offset = length;
-
- requestp->resultp = resultp;
-
- requestp->request_type = _AIO_OP_TRUNCATE;
-
- requestp->cancelled = 0;
-
- resultp->result_type = _AIO_OP_TRUNCATE;
-
- squidaio_queue_request(requestp);
-
- return 0;
-}
-
-
-static void
-squidaio_do_truncate(squidaio_request_t * requestp)
-{
- requestp->ret = truncate(requestp->path, requestp->offset);
- requestp->err = errno;
-}
-
-
-#else
int
squidaio_unlink(const char *path, squidaio_result_t * resultp)
{
requestp->err = errno;
}
-#endif
-
#if AIO_OPENDIR
/* XXX squidaio_opendir NOT implemented yet.. */
debug(43, 5) ("UNLINK of %s\n", request->path);
break;
- case _AIO_OP_TRUNCATE:
- debug(43, 5) ("UNLINK of %s\n", request->path);
- break;
-
default:
break;
}
/*
- * $Id: async_io.cc,v 1.2 2005/07/10 15:43:30 serassio Exp $
+ * $Id: async_io.cc,v 1.3 2007/04/12 23:51:57 wessels Exp $
*
* DEBUG: section 32 Asynchronous Disk I/O
* AUTHOR: Pete Bentley <pete@demon.net>
return;
} /* aioStat */
-#if USE_TRUNCATE
-void
-aioTruncate(const char *path, off_t length, AIOCB * callback, void *callback_data)
-{
- squidaio_ctrl_t *ctrlp;
- assert(DiskThreadsIOStrategy::Instance.initialised);
- squidaio_counts.unlink_start++;
- ctrlp = (squidaio_ctrl_t *)DiskThreadsIOStrategy::Instance.squidaio_ctrl_pool->alloc();
- ctrlp->fd = -2;
- ctrlp->done_handler = callback;
- ctrlp->done_handler_data = cbdataReference(callback_data);
- ctrlp->operation = _AIO_TRUNCATE;
- ctrlp->result.data = ctrlp;
- squidaio_truncate(path, length, &ctrlp->result);
- dlinkAdd(ctrlp, &ctrlp->node, &used_list);
-} /* aioTruncate */
-
-#else
void
aioUnlink(const char *path, AIOCB * callback, void *callback_data)
{
dlinkAdd(ctrlp, &ctrlp->node, &used_list);
} /* aioUnlink */
-#endif
-
int
aioQueueSize(void)
{
/*
- * $Id: store_dir_ufs.cc,v 1.78 2007/04/11 21:22:27 wessels Exp $
+ * $Id: store_dir_ufs.cc,v 1.79 2007/04/12 23:51:58 wessels Exp $
*
* DEBUG: section 47 Store Directory Routines
* AUTHOR: Duane Wessels
struct dirent *de = NULL;
LOCAL_ARRAY(char, p1, MAXPATHLEN + 1);
LOCAL_ARRAY(char, p2, MAXPATHLEN + 1);
-#if USE_TRUNCATE
-
- struct stat sb;
-#endif
int files[20];
int swapfileno;
if (UFSSwapDir::FilenoBelongsHere(fn, D0, D1, D2))
continue;
-#if USE_TRUNCATE
-
- if (!::stat(de->d_name, &sb))
- if (sb.st_size == 0)
- continue;
-
-#endif
-
files[k++] = swapfileno;
}
for (n = 0; n < k; n++) {
debug(36, 3) ("storeDirClean: Cleaning file %08X\n", files[n]);
snprintf(p2, MAXPATHLEN + 1, "%s/%08X", p1, files[n]);
-#if USE_TRUNCATE
-
- truncate(p2, 0);
-#else
-
safeunlink(p2, 0);
-#endif
-
statCounter.swap.files_cleaned++;
}
/*
- * $Id: ufscommon.cc,v 1.7 2007/03/01 07:25:15 wessels Exp $
+ * $Id: ufscommon.cc,v 1.8 2007/04/12 23:51:58 wessels Exp $
* vim: set et :
*
* DEBUG: section 47 Store Directory Routines
store_open_disk_fd--;
fd = -1;
swap_hdr_len = 0;
-#if USE_TRUNCATE
-
- if (sb.st_size == 0)
- continue;
-
-#endif
StoreMetaUnpacker aBuilder(hdr_buf, len, &swap_hdr_len);
/*
- * $Id: unlinkd.cc,v 1.58 2006/09/10 03:49:05 adrian Exp $
+ * $Id: unlinkd.cc,v 1.59 2007/04/12 23:51:56 wessels Exp $
*
* DEBUG: section 2 Unlink Daemon
* AUTHOR: Duane Wessels
while (fgets(buf, UNLINK_BUF_LEN, stdin)) {
if ((t = strchr(buf, '\n')))
*t = '\0';
-
-#if USE_TRUNCATE
-
- x = truncate(buf, 0);
-
-#else
-
x = unlink(buf);
-
-#endif
-
if (x < 0)
printf("ERR\n");
else