aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2012-11-27 21:56:28 +0000
committerdrh <drh@noemail.net>2012-11-27 21:56:28 +0000
commit26cd614dad37c7cf2fdbc788a7517316554c702e (patch)
treedd0c18cc064eaffd9632b1c90ec49730c120939b /src/os_unix.c
parentafe5b83dcdee8faffce1b21b8c52a284311ce2a3 (diff)
parentdac07e14c812cfb8fd8fda27f7a2de3894f240d9 (diff)
downloadsqlite-26cd614dad37c7cf2fdbc788a7517316554c702e.tar.gz
sqlite-26cd614dad37c7cf2fdbc788a7517316554c702e.zip
Update the sessions branch to include the SQLLOG enhancement, the
SQLITE_IOERR_DELETE_NOENT fix, and a fix for the number-of-documents bug in FTS4. FossilOrigin-Name: ba8d08b67021a32fda069c18b7eb93523e6f0d1f
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index ca6213943..a3a012126 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -46,6 +46,13 @@
#include "sqliteInt.h"
#if SQLITE_OS_UNIX /* This file is used on unix only */
+/* Use posix_fallocate() if it is available
+*/
+#if !defined(HAVE_POSIX_FALLOCATE) \
+ && (_XOPEN_SOURCE >= 600 || _POSIX_C_SOURCE >= 200112L)
+# define HAVE_POSIX_FALLOCATE 1
+#endif
+
/*
** There are various methods for file locking used for concurrency
** control:
@@ -4168,11 +4175,19 @@ static int unixShmMap(
** the requested memory region.
*/
if( !bExtend ) goto shmpage_out;
+#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
+ if( osFallocate(pShmNode->h, sStat.st_size, nByte)!=0 ){
+ rc = unixLogError(SQLITE_IOERR_SHMSIZE, "fallocate",
+ pShmNode->zFilename);
+ goto shmpage_out;
+ }
+#else
if( robust_ftruncate(pShmNode->h, nByte) ){
rc = unixLogError(SQLITE_IOERR_SHMSIZE, "ftruncate",
pShmNode->zFilename);
goto shmpage_out;
}
+#endif
}
}