From 49a4e3fb88c9c58d0f1c139c60d71953842616d3 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Thu, 4 Feb 2010 16:05:08 +0000 Subject: [PATCH] Frontported fix for freebsd and related OSs, including CORE-2825 --- builds/posix/prefix.freebsd | 4 ++-- builds/posix/prefix.freebsd_amd64 | 4 ++-- configure.in | 25 +++++++++++++++++++++---- src/jrd/isc.h | 2 +- src/utilities/nbackup.cpp | 6 ++++-- 5 files changed, 30 insertions(+), 11 deletions(-) diff --git a/builds/posix/prefix.freebsd b/builds/posix/prefix.freebsd index cd66e2423e..a31a5f4f85 100644 --- a/builds/posix/prefix.freebsd +++ b/builds/posix/prefix.freebsd @@ -24,7 +24,7 @@ LINK_OPTS+=-Wl,-rpath,../gen/firebird/lib PROD_FLAGS=-O -fno-builtin -DFREEBSD -pipe -MMD -fPIC DEV_FLAGS=-ggdb -DFREEBSD -pipe -MMD -p -fPIC -Wall -Wno-non-virtual-dtor -EMBED_UTIL_TARGETS=gstat gsec nbackup fbguard fb_lock_print -CLIENT_UTIL_TARGETS=gstat gsec fbguard fbmgr_bin nbackup fb_lock_print +EMBED_UTIL_TARGETS=gstat gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr +CLIENT_UTIL_TARGETS=gstat gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr Physical_IO_Module=os/posix/unix.cpp diff --git a/builds/posix/prefix.freebsd_amd64 b/builds/posix/prefix.freebsd_amd64 index 5544e4f733..7657224bd6 100644 --- a/builds/posix/prefix.freebsd_amd64 +++ b/builds/posix/prefix.freebsd_amd64 @@ -24,8 +24,8 @@ LINK_OPTS+=-Wl,-rpath,../gen/firebird/lib PROD_FLAGS=-O -fno-builtin -DFREEBSD -DAMD64 -pipe -MMD -fPIC DEV_FLAGS=-ggdb -DFREEBSD -DAMD64 -pipe -MMD -p -fPIC -Wall -Wno-non-virtual-dtor -EMBED_UTIL_TARGETS=gstat gsec nbackup fbguard fb_lock_print -CLIENT_UTIL_TARGETS=gstat gsec fbguard fbmgr_bin nbackup fb_lock_print +EMBED_UTIL_TARGETS=gstat gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr +CLIENT_UTIL_TARGETS=gstat gsec fbguard nbackup fb_lock_print fbsvcmgr fbtracemgr Physical_IO_Module=os/posix/unix.cpp # This is needed due to broken port of gcc diff --git a/configure.in b/configure.in index a457bfb29c..a24b642f25 100644 --- a/configure.in +++ b/configure.in @@ -110,9 +110,18 @@ dnl CPU_TYPE=ppc64 SHRLIB_EXT=so ;; - amd64-*-freebsd*) - MAKEFILE_PREFIX=freebsd - PLATFORM=FREEBSD + amd64-*-freebsd* | x86_64*-*-k*bsd*-gnu) + MAKEFILE_PREFIX=freebsd_amd64 + case "$target" in + x86_64*-*-k*bsd-gnu) # Debian/kFreeBSD + PLATFORM=LINUX + INSTALL_PREFIX=linux + ;; + *) + PLATFORM=FREEBSD + INSTALL_PREFIX=freebsd + ;; + esac AC_DEFINE(FREEBSD, 1, [Define this if OS is FreeBSD]) AC_DEFINE(AMD64, 1, [Define this if CPU is amd64]) EDITLINE_FLG=Y @@ -129,7 +138,15 @@ dnl CPU_TYPE=ppc64 *-*-freebsd*) MAKEFILE_PREFIX=freebsd - PLATFORM=FREEBSD + case "$target" in + *-*-k*bsd-gnu) # Debian/kFreeBSD + PLATFORM=LINUX + INSTALL_PREFIX=linux + ;; + *) + PLATFORM=FREEBSD + ;; + esac AC_DEFINE(FREEBSD, 1, [Define this if OS is FreeBSD]) EDITLINE_FLG=Y SHRLIB_EXT=so diff --git a/src/jrd/isc.h b/src/jrd/isc.h index 766b5303b3..7a6f237fe3 100644 --- a/src/jrd/isc.h +++ b/src/jrd/isc.h @@ -33,7 +33,7 @@ // Firebird platform-specific synchronization data structures -#if defined(DARWIN) +#if defined(DARWIN) || defined(FREEBSD) #define USE_SYS5SEMAPHORE #endif diff --git a/src/utilities/nbackup.cpp b/src/utilities/nbackup.cpp index 2874ac1265..9aa38f0b19 100644 --- a/src/utilities/nbackup.cpp +++ b/src/utilities/nbackup.cpp @@ -213,8 +213,6 @@ namespace return rc; } #else // HAVE_POSIX_FADVISE -#define POSIX_FADV_SEQUENTIAL 0 -#define POSIX_FADV_NOREUSE 0 int fb_fadvise(int, off_t, size_t, int) { return 0; @@ -444,12 +442,15 @@ void NBackup::open_database_scan() status_exception::raise(Arg::Gds(isc_nbackup_err_opendb) << dbname.c_str() << Arg::OsError()); } +#ifdef POSIX_FADV_SEQUENTIAL int rc = fb_fadvise(dbase, 0, 0, POSIX_FADV_SEQUENTIAL); if (rc) { status_exception::raise(Arg::Gds(isc_nbackup_err_fadvice) << "SEQUENTIAL" << dbname.c_str() << Arg::Unix(rc)); } +#endif // POSIX_FADV_SEQUENTIAL +#ifdef POSIX_FADV_NOREUSE if (direct_io) { rc = fb_fadvise(dbase, 0, 0, POSIX_FADV_NOREUSE); @@ -459,6 +460,7 @@ void NBackup::open_database_scan() "NOREUSE" << dbname.c_str() << Arg::Unix(rc)); } } +#endif // POSIX_FADV_NOREUSE #endif // WIN_NT }