Browse Source

Merge branch 'maint'

* maint:
  Support posix_madvise(2) for Solaris
Bryan Drewery 11 years ago
parent
commit
08e73b6b03
4 changed files with 8 additions and 3 deletions
  1. 1 1
      build/autotools/configure.ac
  2. 1 1
      configure
  3. 3 1
      src/binary.c
  4. 3 0
      src/config.h.in

+ 1 - 1
build/autotools/configure.ac

@@ -198,7 +198,7 @@ AC_FUNC_STRFTIME
 
 #checkpoint
 AC_CACHE_SAVE
-AC_CHECK_FUNCS([clock fsync getrusage isascii getpassphrase madvise])
+AC_CHECK_FUNCS([clock fsync getrusage isascii getpassphrase posix_madvise madvise])
 AC_CHECK_FUNCS([memcpy memmem memset random rename snprintf srandom gettime])
 #checkpoint
 AC_CACHE_SAVE

+ 1 - 1
configure

@@ -8589,7 +8589,7 @@ $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
 rm -f confcache
-for ac_func in clock fsync getrusage isascii getpassphrase madvise
+for ac_func in clock fsync getrusage isascii getpassphrase posix_madvise madvise
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_cxx_check_func "$LINENO" "$ac_func" "$as_ac_var"

+ 3 - 1
src/binary.c

@@ -178,7 +178,9 @@ bin_checksum(const char *fname, int todo)
     close(fd);
     werr(ERR_BINSTAT);
   }
-#ifdef HAVE_MADVISE
+#if defined(HAVE_POSIX_MADVISE)
+  posix_madvise(map, size, POSIX_MADV_SEQUENTIAL);
+#elif defined(HAVE_MADVISE)
   madvise(map, size, MADV_SEQUENTIAL);
 #endif
   MD5_Update(&ctx, map, offset);

+ 3 - 0
src/config.h.in

@@ -140,6 +140,9 @@
 /* Define to 1 if you have the <paths.h> header file. */
 #undef HAVE_PATHS_H
 
+/* Define to 1 if you have the `posix_madvise' function. */
+#undef HAVE_POSIX_MADVISE
+
 /* Define to 1 if you have the `random' function. */
 #undef HAVE_RANDOM