bridges/source/cpp_uno/shared/makefile.mk       |    4 ++++
 bridges/source/cpp_uno/shared/vtablefactory.cxx |    8 ++++++++
 configure.in                                    |    2 ++
 set_soenv.in                                    |    1 +
 4 files changed, 15 insertions(+)

New commits:
commit 2938ec5539b54e98e801ae14ccb2c163cd94a92a
Author: Robert Nagy <robert.n...@gmail.com>
Date:   Wed Dec 21 16:16:22 2011 +0100

    only use posix_fallocate() if it's actually available

diff --git a/bridges/source/cpp_uno/shared/makefile.mk 
b/bridges/source/cpp_uno/shared/makefile.mk
index 4ce8122..c71ba6b 100644
--- a/bridges/source/cpp_uno/shared/makefile.mk
+++ b/bridges/source/cpp_uno/shared/makefile.mk
@@ -33,6 +33,10 @@ ENABLE_EXCEPTIONS = TRUE
 
 .INCLUDE: settings.mk
 
+.IF "$(HAVE_POSIX_FALLOCATE)" == "YES"
+CDEFS += -DHAVE_POSIX_FALLOCATE
+.ENDIF
+
 SLOFILES = \
     $(SLO)$/bridge.obj \
     $(SLO)$/component.obj \
diff --git a/bridges/source/cpp_uno/shared/vtablefactory.cxx 
b/bridges/source/cpp_uno/shared/vtablefactory.cxx
index 801b16c..4d7e867 100644
--- a/bridges/source/cpp_uno/shared/vtablefactory.cxx
+++ b/bridges/source/cpp_uno/shared/vtablefactory.cxx
@@ -264,10 +264,18 @@ bool VtableFactory::createBlock(Block &block, sal_Int32 
slotCount) const
         }
         unlink(tmpfname);
         delete[] tmpfname;
+#if defined(HAVE_POSIX_FALLOCATE)
         int err = posix_fallocate(block.fd, 0, block.size);
+#else
+        int err = ftruncate(block.fd, block.size);
+#endif
         if (err != 0)
         {
+#if defined(HAVE_POSIX_FALLOCATE)
             SAL_WARN("bridges", "posix_fallocate failed with code " << err);
+#else
+            SAL_WARN("bridges", "truncation of executable memory area failed 
with code " << err);
+#endif
             close(block.fd);
             block.fd = -1;
             break;
diff --git a/configure.in b/configure.in
index 290b294..40b20eb 100644
--- a/configure.in
+++ b/configure.in
@@ -3843,6 +3843,8 @@ fi
 if test "$with_alloc" = "internal" -o -z "$with_alloc"; then
     AC_MSG_RESULT([internal])
 fi
+AC_CHECK_FUNCS(posix_fallocate, HAVE_POSIX_FALLOCATE=YES, 
[HAVE_POSIX_FALLOCATE=NO])
+AC_SUBST(HAVE_POSIX_FALLOCATE)
 AC_SUBST(ALLOC)
 
 dnl ===================================================================
diff --git a/set_soenv.in b/set_soenv.in
index 5347a84..afaac53 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1999,6 +1999,7 @@ ToFile( "HUNSPELL_LIBS",     "@HUNSPELL_LIBS@",    "e" );
 ToFile( "SYSTEM_LPSOLVE",    "@SYSTEM_LPSOLVE@",   "e" );
 ToFile( "HAVE_GETOPT",       "@HAVE_GETOPT@",      "e" );
 ToFile( "HAVE_READDIR_R",    "@HAVE_READDIR_R@",   "e" );
+ToFile( "HAVE_POSIX_FALLOCATE",    "@HAVE_POSIX_FALLOCATE@",   "e" );
 ToFile( "SYSTEM_LIBC",       "@SYSTEM_LIBC@",      "e" );
 ToFile( "SYSTEM_HYPH",       "@SYSTEM_HYPH@",      "e" );
 ToFile( "HYPHEN_LIB",        "@HYPHEN_LIB@",       "e" );
_______________________________________________
Libreoffice-commits mailing list
Libreoffice-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to