Add reminder about enabling mmap() use after 4.4.2.1.

The code's been unused for years so too risky to enable right now but should
offer good performance improvement. Fix the HAVE_MMAP checks.
This commit is contained in:
Panu Matilainen 2007-06-20 10:58:10 +03:00
parent 57a53d1080
commit a36fe66361
3 changed files with 9 additions and 5 deletions

View File

@ -811,6 +811,10 @@ AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_VPRINTF
dnl XXX don't want to re-enable code that's been unused for years at this
dnl point, but should offer good performance improvements, check after
dnl 4.4.2.1...
dnl AC_FUNC_MMAP
AC_CHECK_FUNCS(basename getcwd getwd inet_aton mtrace putenv realpath setenv)
AC_CHECK_FUNCS(stpcpy stpncpy strcspn)

View File

@ -944,7 +944,7 @@ static int writeFile(/*@special@*/ /*@partial@*/ FSM_t fsm, int writeData)
if (rc) goto exit;
if (writeData && S_ISREG(st->st_mode)) {
#if HAVE_MMAP
#ifdef HAVE_MMAP
char * rdbuf = NULL;
void * mapped = (void *)-1;
size_t nmapped;
@ -954,7 +954,7 @@ static int writeFile(/*@special@*/ /*@partial@*/ FSM_t fsm, int writeData)
if (rc) goto exit;
/* XXX unbuffered mmap generates *lots* of fdio debugging */
#if HAVE_MMAP
#ifdef HAVE_MMAP
nmapped = 0;
mapped = mmap(NULL, st->st_size, PROT_READ, MAP_SHARED, Fileno(fsm->rfd), 0);
if (mapped != (void *)-1) {
@ -970,7 +970,7 @@ static int writeFile(/*@special@*/ /*@partial@*/ FSM_t fsm, int writeData)
left = st->st_size;
while (left) {
#if HAVE_MMAP
#ifdef HAVE_MMAP
if (mapped != (void *)-1) {
fsm->rdnb = nmapped;
} else
@ -988,7 +988,7 @@ static int writeFile(/*@special@*/ /*@partial@*/ FSM_t fsm, int writeData)
left -= fsm->wrnb;
}
#if HAVE_MMAP
#ifdef HAVE_MMAP
/*@-branchstate@*/
if (mapped != (void *)-1) {
xx = msync(mapped, nmapped, MS_ASYNC);

View File

@ -170,7 +170,7 @@ int domd5(const char * fn, unsigned char * digest, int asAscii, size_t *fsizep)
switch(ut) {
case URL_IS_PATH:
case URL_IS_UNKNOWN:
#if HAVE_MMAP
#ifdef HAVE_MMAP
if (pid == 0) {
DIGEST_CTX ctx;
void * mapped;