[Libreoffice-commits] .: bridges/source configure.in set_soenv.in
Robert Nagy
rnagy at kemper.freedesktop.org
Wed Dec 21 07:17:53 PST 2011
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 b8b22391ae7f87c8fb495a9e6839ed508fdaf932
Author: Robert Nagy <robert.nagy at 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 b049c7f..830d899 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 49c9758..897403a 100644
--- a/configure.in
+++ b/configure.in
@@ -3879,6 +3879,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 06c8b30..b88c0cf 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1934,6 +1934,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" );
More information about the Libreoffice-commits
mailing list