diff --git a/configure.in b/configure.in index 4ce08d3351..a820efd735 100644 --- a/configure.in +++ b/configure.in @@ -684,7 +684,7 @@ CFLAGS="$CFLAGS $PTHREAD_CFLAGS" AC_CHECK_FUNCS(sem_timedwait) AC_CHECK_FUNCS(sem_init) if test "$ac_cv_func_sem_init" = "yes"; then -AC_MSG_CHECKING(for working sem_int()) +AC_MSG_CHECKING(for working sem_init()) AC_TRY_RUN([#include main () { sem_t s; @@ -698,6 +698,7 @@ fi CFLAGS="$savedFlags" fi AC_CHECK_FUNCS(semtimedop) +AC_CHECK_FUNCS(posix_fadvise) # Checks for typedefs, structures, and compiler characteristics. AC_C_BIGENDIAN diff --git a/src/utilities/nbackup.cpp b/src/utilities/nbackup.cpp index 06fd2f40af..d7c1158eca 100644 --- a/src/utilities/nbackup.cpp +++ b/src/utilities/nbackup.cpp @@ -329,10 +329,16 @@ void nbackup::open_database_scan() if (dbase == INVALID_HANDLE_VALUE) b_error::raise("Error (%d) opening database file: %s", GetLastError(), dbname.c_str()); #else - dbase = open(dbname.c_str(), O_RDONLY | O_LARGEFILE); - if (dbase < 0) - b_error::raise("Error (%d) opening database file: %s", errno, dbname.c_str()); -#endif + dbase = open(dbname.c_str(), O_RDONLY | O_LARGEFILE | O_NOATIME | O_DIRECT); + if (dbase < 0) + b_error::raise("Error (%d) opening database file: %s", errno, dbname.c_str()); +#ifdef HAVE_POSIX_FADVISE + if (posix_fadvise(dbase, 0, 0, POSIX_FADV_SEQUENTIAL) < 0) + b_error::raise(uSvc, "Error (%d) in posix_fadvise(SEQUENTIAL) for %s", errno, dbname.c_str()); + if (posix_fadvise(dbase, 0, 0, POSIX_FADV_NOREUSE) < 0) + b_error::raise(uSvc, "Error (%d) in posix_fadvise(NOREUSE) for %s", errno, dbname.c_str()); +#endif //HAVE_POSIX_FADVISE +#endif //WIN_NT } void nbackup::create_database()