From 5116c8f075f4734786ac49c691685794f7c3a959 Mon Sep 17 00:00:00 2001 From: Mike Silbersack Date: Fri, 14 Nov 2003 18:32:49 +0000 Subject: Fix up mmc_unmap so that it does not try to search on the (unused) addr field with USE_SENDFILE is defined. --- www/thttpd/files/patch-mmc.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'www/thttpd') diff --git a/www/thttpd/files/patch-mmc.c b/www/thttpd/files/patch-mmc.c index bf2c9f6ed641..c992a3250844 100644 --- a/www/thttpd/files/patch-mmc.c +++ b/www/thttpd/files/patch-mmc.c @@ -1,5 +1,5 @@ ---- mmc.c.orig Wed May 8 03:35:05 2002 -+++ mmc.c Sun Oct 20 23:56:15 2002 +--- mmc.c.orig Tue Oct 22 09:42:01 2002 ++++ mmc.c Fri Nov 14 12:26:39 2003 @@ -74,6 +74,9 @@ time_t ctime; int refcount; @@ -33,7 +33,7 @@ /* Map the file into memory. */ m->addr = mmap( 0, size_size, PROT_READ, MAP_PRIVATE, fd, 0 ); if ( m->addr == (void*) -1 && errno == ENOMEM ) -@@ -240,8 +249,9 @@ +@@ -234,8 +243,9 @@ } #endif /* HAVE_MMAP */ } @@ -44,7 +44,7 @@ /* Put the Map into the hash table. */ if ( add_hash( m ) < 0 ) { -@@ -259,8 +269,12 @@ +@@ -253,8 +263,12 @@ /* Update the total byte count. */ mapped_bytes += m->size; @@ -57,7 +57,26 @@ } -@@ -369,7 +383,9 @@ +@@ -267,14 +281,18 @@ + if ( sbP != (struct stat*) 0 ) + { + m = find_hash( sbP->st_ino, sbP->st_dev, sbP->st_size, sbP->st_ctime ); ++#ifndef USE_SENDFILE + if ( m != (Map*) 0 && m->addr != addr ) + m = (Map*) 0; ++#endif + } ++#ifndef USE_SENDFILE + /* If that didn't work, try a full search. */ + if ( m == (Map*) 0 ) + for ( m = maps; m != (Map*) 0; m = m->next ) + if ( m->addr == addr ) + break; ++#endif + if ( m == (Map*) 0 ) + syslog( LOG_ERR, "mmc_unmap failed to find entry!" ); + else if ( m->refcount <= 0 ) +@@ -363,7 +381,9 @@ m = *mm; if ( m->size != 0 ) { -- cgit v1.2.3