Add reminder about enabling mmap() use after 4.4.2.1.
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 20 Jun 2007 07:58:10 +0000 (10:58 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 20 Jun 2007 07:58:10 +0000 (10:58 +0300)
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.

configure.ac
lib/fsm.c
rpmdb/legacy.c

index 31315bc..a7b20df 100644 (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)
index 40b71d7..435bf71 100644 (file)
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -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);
index 5fa0431..b97d67b 100644 (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;