]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update the configure script to detect pread/pwrite and update os_unix.c to
authordrh <drh@noemail.net>
Fri, 4 Mar 2016 02:38:00 +0000 (02:38 +0000)
committerdrh <drh@noemail.net>
Fri, 4 Mar 2016 02:38:00 +0000 (02:38 +0000)
use those routines if they are available.

FossilOrigin-Name: 2cffb9e50bed77d1079603f5b4a71b7559de7294

config.h.in
configure
configure.ac
manifest
manifest.uuid
src/os_unix.c

index 36fd60781c6e1c2b8da9e34a6f7a7e2b38e3b014..f2ba7d4fc4ca9c1a87daa0381eecbbea1b653f88 100644 (file)
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
+/* Define to 1 if you have the pread() function. */
+#undef HAVE_PREAD
+
+/* Define to 1 if you have the pread64() function. */
+#undef HAVE_PREAD64
+
+/* Define to 1 if you have the pwrite() function. */
+#undef HAVE_PWRITE
+
+/* Define to 1 if you have the pwrite64() function. */
+#undef HAVE_PWRITE64
+
 /* Define to 1 if you have the <stdint.h> header file. */
 #undef HAVE_STDINT_H
 
index 09fba81eaee0eedb3c6e50b707faf91c5f0e9630..8363818c6f887dcbce9103b637cfc914527a3ce5 100755 (executable)
--- a/configure
+++ b/configure
@@ -10273,7 +10273,7 @@ done
 #########
 # Figure out whether or not we have these functions
 #
-for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime
+for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 19f85dc8752683be8f4cc2ac1885d5243073bb2a..08c8867f06f118cd61df3e76442c8972daa3ebff 100644 (file)
@@ -108,7 +108,7 @@ AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
 #########
 # Figure out whether or not we have these functions
 #
-AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime])
+AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64])
 
 #########
 # By default, we use the amalgamation (this may be changed below...)
index 7f7098914686f6553129881524ead0531cf0dfd0..06e5c8c969d41bcd2b4053ce43e909ddfafb38d1 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Reduce\sthe\samount\sof\sheap\smemory\srequired\sto\sstore\smany\sschemas\sby\sstoring\s\nthe\scolumn\sdatatype\sappended\sto\sthe\scolumn\sname\s(with\sa\s\\000\sseparator),\s\nrather\sthan\sin\sseparate\smemory\sallocation.
-D 2016-03-03T21:22:53.735
+C Update\sthe\sconfigure\sscript\sto\sdetect\spread/pwrite\sand\supdate\sos_unix.c\sto\nuse\sthose\sroutines\sif\sthey\sare\savailable.
+D 2016-03-04T02:38:00.565
 F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1
@@ -28,10 +28,10 @@ F autoconf/tea/win/makefile.vc f89d0184d0eee5f7e356ea407964dcd139939928
 F autoconf/tea/win/nmakehlp.c 247538ad8e8c508f33c03ec1fbd67d3a07ef6291
 F autoconf/tea/win/rules.vc c511f222b80064096b705dbeb97060ee1d6b6d63
 F config.guess 226d9a188c6196f3033ffc651cbc9dcee1a42977
-F config.h.in 42b71ad3fe21c9e88fa59e8458ca1a6bc72eb0c0
+F config.h.in 6376abec766e9a0785178b1823b5a587e9f1ccbc
 F config.sub 9ebe4c3b3dab6431ece34f16828b594fb420da55
-F configure 0339a635cd2943a3b56000a10a11b4b2e6ed6d1b x
-F configure.ac a2224b1162f79848982d3618ac1deffcd94e88ec
+F configure c01a159fdf7ea0171ad01ce2937283f2c7972bde x
+F configure.ac 89e4e02a83d8a1528011f8395621b8c3186b4089
 F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
 F doc/lemon.html c30255bea0fd87a81f082d17a72c9dffbc3f6dd9
 F doc/pager-invariants.txt 27fed9a70ddad2088750c4a2b493b63853da2710
@@ -333,7 +333,7 @@ F src/os.c ca9a104b677328ee037cfdf1a54a16fd1805e8c9
 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf
 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85
 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa
-F src/os_unix.c 3a6f20736dfb8a0949cdd66553fdf59f6604be35
+F src/os_unix.c a1aaf2d8d253138e63d2a8a972693f9f624f885d
 F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d
 F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
 F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b
@@ -1453,8 +1453,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 3eb74342740cd393e03aa38cd01690ccab173b76 842b21162713bb141b845b01c136457a31af4ab0
-R 8594cd13d54710bae620a17d4ba5114b
-T +closed 842b21162713bb141b845b01c136457a31af4ab0
+P 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6
+R 8390ec5e0d9e5eb3999e5eee0cb5ce81
 U drh
-Z 4f9819dace7a151b6043885dfe386959
+Z b764ac5f33b779f6bf5d09a763220c12
index 82610772e0c60be1c430e929eca3d00886e7a47c..ec9225526f576d159495abfebd771a5bdb4f284d 100644 (file)
@@ -1 +1 @@
-16fbf2e19c22df9441aef5c8b7f5670adc38a6b6
\ No newline at end of file
+2cffb9e50bed77d1079603f5b4a71b7559de7294
\ No newline at end of file
index ea07bd99f3322a06af6564340039a6f6be8c5340..9bcefb11950150e1015cb22e3c0fb1b929ca6ba0 100644 (file)
 #  endif
 #endif
 
+/* Use pread() and pwrite() if they are available */
+#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64)
+# undef USE_PREAD
+# undef USE_PWRITE
+# define USE_PREAD64 1
+# define USE_PWRITE64 1
+#elif defined(HAVE_PREAD) && defined(HAVE_PWRITE)
+# undef USE_PREAD
+# undef USE_PWRITE
+# define USE_PREAD64 1
+# define USE_PWRITE64 1
+#endif
+
+
 /*
 ** standard include files.
 */
@@ -200,6 +214,9 @@ struct unixFile {
   const char *zPath;                  /* Name of the file */
   unixShm *pShm;                      /* Shared memory segment information */
   int szChunk;                        /* Configured by FCNTL_CHUNK_SIZE */
+#if !defined(USE_PREAD) && !defined(USE_PREAD64)
+  off64_t iOfst;                      /* Current offset */
+#endif
 #if SQLITE_MAX_MMAP_SIZE>0
   int nFetchOut;                      /* Number of outstanding xFetch refs */
   sqlite3_int64 mmapSize;             /* Usable size of mapping at pMapRegion */
@@ -3097,9 +3114,6 @@ static int nfsUnlock(sqlite3_file *id, int eFileLock){
 static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
   int got;
   int prior = 0;
-#if (!defined(USE_PREAD) && !defined(USE_PREAD64))
-  i64 newOffset;
-#endif
   TIMER_START;
   assert( cnt==(cnt&0x1ffff) );
   assert( id->h>2 );
@@ -3111,13 +3125,15 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
     got = osPread64(id->h, pBuf, cnt, offset);
     SimulateIOError( got = -1 );
 #else
-    newOffset = lseek(id->h, offset, SEEK_SET);
-    SimulateIOError( newOffset = -1 );
-    if( newOffset<0 ){
-      storeLastErrno((unixFile*)id, errno);
-      return -1;
-    }
-    got = osRead(id->h, pBuf, cnt);
+    if( offset!=id->iOfst ){
+      id->iOfst = lseek(id->h, offset, SEEK_SET);
+      SimulateIOError( id->iOfst = -1 );
+      if( id->iOfst<0 ){
+        storeLastErrno((unixFile*)id, errno);
+        return -1;
+      }
+      got = osRead(id->h, pBuf, cnt);
+      if( got>=0 ) id->iOfst += got;
 #endif
     if( got==cnt ) break;
     if( got<0 ){
@@ -3223,6 +3239,7 @@ static int seekAndWriteFd(
   do{ rc = (int)osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR);
 #else
   do{
+    if( iOff!=fd
     i64 iSeek = lseek(fd, iOff, SEEK_SET);
     SimulateIOError( iSeek = -1 );
     if( iSeek<0 ){