diff options
-rw-r--r-- | Makefile.am | 12 | ||||
-rw-r--r-- | configure.ac | 16 | ||||
-rw-r--r-- | doc/README.html.in | 10 | ||||
-rw-r--r-- | doc/style.css | 1 | ||||
-rw-r--r-- | src/syrep.c | 9 | ||||
-rw-r--r-- | src/util.c | 28 |
6 files changed, 50 insertions, 26 deletions
diff --git a/Makefile.am b/Makefile.am index 575c227..1595fa7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,13 +28,13 @@ README: ln -s doc/README README homepage: all dist - test -d $$HOME/homepage/lennart - mkdir -p $$HOME/homepage/lennart/projects/syrep - cp *.tar.gz $$HOME/homepage/lennart/projects/syrep - cp doc/README.html doc/style.css man/syrep.1.xml man/xmltoman.css man/xmltoman.xsl man/xmltoman.dtd $$HOME/homepage/lennart/projects/syrep - ln -sf $$HOME/homepage/lennart/projects/syrep/README.html $$HOME/homepage/lennart/projects/syrep/index.html + test -d $$HOME/homepage/private + mkdir -p $$HOME/homepage/private/projects/syrep + cp *.tar.gz $$HOME/homepage/private/projects/syrep + cp doc/README.html doc/style.css man/syrep.1.xml man/xmltoman.css man/xmltoman.xsl man/xmltoman.dtd $$HOME/homepage/private/projects/syrep + ln -sf $$HOME/homepage/private/projects/syrep/README.html $$HOME/homepage/private/projects/syrep/index.html distcleancheck: - @: + @: .PHONY: homepage distcleancheck diff --git a/configure.ac b/configure.ac index 203b481..fe9941d 100644 --- a/configure.ac +++ b/configure.ac @@ -19,8 +19,8 @@ # along with syrep; if not, write to the Free Software Foundation, # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -AC_PREREQ(2.57) -AC_INIT([syrep], [0.4], [mzflerc (at) 0pointer (dot) de]) +AC_PREREQ(2.59) +AC_INIT([syrep],[0.4],[mzflerc (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([src/syrep.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign -Wall]) @@ -50,11 +50,11 @@ AC_CHECK_HEADER([db.h],, [AC_MSG_ERROR([*** Sorry, you have to install the Berke LIBS="$LIBS -ldb" # Checking libdb version number -AC_MSG_CHECKING([for Berkeley libdb 4.1]) +AC_MSG_CHECKING([for Berkeley libdb 4.2]) AC_LANG_PUSH(C) AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ #include <db.h> -#if (DB_VERSION_MAJOR != 4) || (DB_VERSION_MINOR != 1) +#if (DB_VERSION_MAJOR != 4) || (DB_VERSION_MINOR != 2) #error "foo" #endif ]])], @@ -104,7 +104,7 @@ AC_CHECK_FUNCS([atexit ftruncate getcwd gethostname memset mkdir munmap rmdir se # LYNX documentation generation AC_ARG_ENABLE(lynx, - AC_HELP_STRING([--disable-lynx], [Turn off lynx usage for documentation generation]), + AS_HELP_STRING(--disable-lynx,Turn off lynx usage for documentation generation), [case "${enableval}" in yes) lynx=yes ;; no) lynx=no ;; @@ -123,7 +123,7 @@ AM_CONDITIONAL([USE_LYNX], [test "x$lynx" = xyes]) # XMLTOMAN manpage generation AC_ARG_ENABLE(xmltoman, - AC_HELP_STRING([--disable-xmltoman], [Disable rebuilding of man pages with xmltoman]), + AS_HELP_STRING(--disable-xmltoman,Disable rebuilding of man pages with xmltoman), [case "${enableval}" in yes) xmltoman=yes ;; no) xmltoman=no ;; @@ -143,7 +143,7 @@ AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes]) # gengetopt command line parser generation AC_ARG_ENABLE(gengetopt, - AC_HELP_STRING([--disable-gengetopt], [Disable rebuilding of command line parser with gengetopt]), + AS_HELP_STRING(--disable-gengetopt,Disable rebuilding of command line parser with gengetopt), [case "${enableval}" in yes) gengetopt=yes ;; no) gengetopt=no ;; @@ -163,7 +163,7 @@ AM_CONDITIONAL([USE_GENGETOPT], [test "x$gengetopt" = xyes]) # subversion release number generation AC_ARG_ENABLE(subversion, - AC_HELP_STRING([--disable-subversion], [Disable rebuilding of svn-release.h]), + AS_HELP_STRING(--disable-subversion,Disable rebuilding of svn-release.h), [case "${enableval}" in yes) subversion=yes ;; no) subversion=no ;; diff --git a/doc/README.html.in b/doc/README.html.in index a5551fa..5e723e4 100644 --- a/doc/README.html.in +++ b/doc/README.html.in @@ -10,7 +10,7 @@ <body> <h1><a name="top">syrep @PACKAGE_VERSION@</a></h1> -<p><i>Copyright 2003 Lennart Poettering <@PACKAGE_BUGREPORT@></i></p> +<p><i>Copyright 2003,2004 Lennart Poettering <@PACKAGE_BUGREPORT@></i></p> <ul class="toc"> <li><a href="#license">License</a></li> @@ -42,6 +42,10 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</p> <h2><a name="news">News</a></h2> +<div class="news-date">Mon Mar 22 2004: </div> <p class="news-text"><a +href="@PACKAGE_URL@syrep-0.4.tar.gz">Version 0.4</a> released; Changes +include: fix annonoying SIGBUS failure when working on files >= 100 MB, update to Berkeley DB 4.2, use <tt>madvise()</tt> to improve file copying throughput on newer kernels, minor other fixes </p> + <div class="news-date">Sun Nov 30 2003: </div> <p class="news-text"><a href="@PACKAGE_URL@syrep-0.3.tar.gz">Version 0.3</a> released; Changes include: new options <tt>--sort</tt>, <tt>--check-md</tt>, @@ -227,9 +231,9 @@ L. Peter Deutsch. Thanks to him for this.</p> <hr/> -<address>Lennart Poettering <@PACKAGE_BUGREPORT@>, Nov 2003</address> +<address class="grey">Lennart Poettering <@PACKAGE_BUGREPORT@>, March 2004</address> -<div><i>$Id$</i></div> +<div class="grey"><i>$Id$</i></div> </body> </html> diff --git a/doc/style.css b/doc/style.css index 110f73c..7aee082 100644 --- a/doc/style.css +++ b/doc/style.css @@ -29,3 +29,4 @@ h1 { color: #00009F; } h2 { color: #00009F; } h3 { color: #00004F; margin-left: 0.5cm; } pre { margin-left: .5cm; background-color: #f0f0f0; padding: 0.4cm;} +.grey { color: #afafaf; } diff --git a/src/syrep.c b/src/syrep.c index 059dde0..17e6427 100644 --- a/src/syrep.c +++ b/src/syrep.c @@ -545,12 +545,17 @@ static int version(const char *argv0) { "Compiled with %i Bit off_t.\n" "Compiled with zlib %s, linked to zlib %s.\n" "Compiled with libdb %i.%i.%i, linked to libdb %i.%i.%i\n" - "SVN Revision "SVN_REVISION"\n", + "SVN Revision "SVN_REVISION"\n" +#ifdef USE_SENDFILE + "Using sendfile(): yes\n", +#else + "Using sendfile(): no\n", +#endif argv0, sizeof(off_t)*8, ZLIB_VERSION, zlibVersion(), DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH, - major, minor, patch); + major, minor, patch ); return 0; } @@ -263,18 +263,20 @@ int copy_fd(int sfd, int dfd, off_t l) { return -1; } - msfo = (sfo/psize)*psize; + msfo = (off_t) (sfo/psize)*psize; sm = m+(sfo-msfo); - sp = mmap(NULL, sm, PROT_READ, MAP_SHARED, sfd, msfo); + if ((sp = mmap(NULL, sm, PROT_READ, MAP_SHARED, sfd, msfo)) != MAP_FAILED) + madvise(sp, sm, MADV_SEQUENTIAL); } if ((dfo = lseek(dfd, 0, SEEK_CUR)) != (off_t) -1) { if (expand_file(dfd, dfo+l) < 0) return -1; - mdfo = (dfo/psize)*psize; + mdfo = (off_t) (dfo/psize)*psize; dm = m+(dfo-mdfo); - dp = mmap(NULL, dm, PROT_READ|PROT_WRITE, MAP_SHARED, dfd, mdfo); + if ((dp = mmap(NULL, dm, PROT_READ|PROT_WRITE, MAP_SHARED, dfd, mdfo)) != MAP_FAILED) + madvise(dp, dm, MADV_SEQUENTIAL); } } @@ -346,6 +348,8 @@ int copy_fd(int sfd, int dfd, off_t l) { return 0; } + + m = (size_t) (l < MMAPSIZE ? l : MMAPSIZE); mdfo = (dfo/psize)*psize; dm = m+(dfo-mdfo); @@ -353,6 +357,7 @@ int copy_fd(int sfd, int dfd, off_t l) { fprintf(stderr, "mmap(): %s\n", strerror(errno)); return -1; } + madvise(dp, dm, MADV_SEQUENTIAL); } } else if (dp == MAP_FAILED) { /* copy mmap to fd */ @@ -382,6 +387,8 @@ int copy_fd(int sfd, int dfd, off_t l) { return 0; } + + m = (size_t) (l < MMAPSIZE ? l : MMAPSIZE); msfo = (sfo/psize)*psize; sm = m+(sfo-msfo); @@ -389,10 +396,13 @@ int copy_fd(int sfd, int dfd, off_t l) { fprintf(stderr, "mmap(): %s\n", strerror(errno)); return -1; } + madvise(sp, sm, MADV_SEQUENTIAL); } } else { /* copy mmap to mmap */ + assert(sp != MAP_FAILED && dp != MAP_FAILED); + for (;;) { memcpy(dp+(dfo-mdfo), sp+(sfo-msfo), m); @@ -415,20 +425,24 @@ int copy_fd(int sfd, int dfd, off_t l) { return 0; } - msfo = (sfo/psize)*psize; + m = (size_t) (l < MMAPSIZE ? l : MMAPSIZE); + + msfo = (off_t) (sfo/psize)*psize; sm = m+(sfo-msfo); if ((sp = mmap(NULL, sm, PROT_READ, MAP_SHARED, sfd, msfo)) == MAP_FAILED) { fprintf(stderr, "mmap(): %s\n", strerror(errno)); return -1; } - - mdfo = (dfo/psize)*psize; + mdfo = (off_t) (dfo/psize)*psize; dm = m+(dfo-mdfo); if ((dp = mmap(NULL, dm, PROT_READ|PROT_WRITE, MAP_SHARED, dfd, mdfo)) == MAP_FAILED) { munmap(sp, sm); fprintf(stderr, "mmap(): %s\n", strerror(errno)); return -1; } + + madvise(sp, sm, MADV_SEQUENTIAL); + madvise(dp, dm, MADV_SEQUENTIAL); } } } |