/ Check-in [82cbf5ad]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Detect the presence of pread()/pwrite() system calls on unix systems and use them if available.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 82cbf5ad2ed988a006106e188e98096a52e6779d
User & Date: drh 2016-03-04 03:20:05
Context
2016-03-04
03:43
Change the default page size for new database files to 4096 (from 1024). Except, when building the testfixture, preserve the legacy page size. Also fix a comment on SQLITE_MAX_ATTACHED. check-in: 2e8a9ca9 user: drh tags: trunk
03:20
Detect the presence of pread()/pwrite() system calls on unix systems and use them if available. check-in: 82cbf5ad user: drh tags: trunk
03:14
Further fixes to the pread()/pwrite() enabling logic. Closed-Leaf check-in: 38fb54e7 user: drh tags: pread
02:59
Add the test_bestindex.c file to Makefile.in and Makefile.msc so that "make test" will work again. check-in: 6ec6b6a9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to config.h.in.

    40     40   #undef HAVE_MALLOC_H
    41     41   
    42     42   /* Define to 1 if you have the `malloc_usable_size' function. */
    43     43   #undef HAVE_MALLOC_USABLE_SIZE
    44     44   
    45     45   /* Define to 1 if you have the <memory.h> header file. */
    46     46   #undef HAVE_MEMORY_H
           47  +
           48  +/* Define to 1 if you have the pread() function. */
           49  +#undef HAVE_PREAD
           50  +
           51  +/* Define to 1 if you have the pread64() function. */
           52  +#undef HAVE_PREAD64
           53  +
           54  +/* Define to 1 if you have the pwrite() function. */
           55  +#undef HAVE_PWRITE
           56  +
           57  +/* Define to 1 if you have the pwrite64() function. */
           58  +#undef HAVE_PWRITE64
    47     59   
    48     60   /* Define to 1 if you have the <stdint.h> header file. */
    49     61   #undef HAVE_STDINT_H
    50     62   
    51     63   /* Define to 1 if you have the <stdlib.h> header file. */
    52     64   #undef HAVE_STDLIB_H
    53     65   

Changes to configure.

 10269  10269   
 10270  10270   done
 10271  10271   
 10272  10272   
 10273  10273   #########
 10274  10274   # Figure out whether or not we have these functions
 10275  10275   #
 10276         -for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime
        10276  +for ac_func in fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
 10277  10277   do :
 10278  10278     as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 10279  10279   ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
 10280  10280   if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
 10281  10281     cat >>confdefs.h <<_ACEOF
 10282  10282   #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 10283  10283   _ACEOF

Changes to configure.ac.

   104    104   #########
   105    105   # Check for needed/wanted headers
   106    106   AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h malloc.h])
   107    107   
   108    108   #########
   109    109   # Figure out whether or not we have these functions
   110    110   #
   111         -AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime])
          111  +AC_CHECK_FUNCS([fdatasync gmtime_r isnan localtime_r localtime_s malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64])
   112    112   
   113    113   #########
   114    114   # By default, we use the amalgamation (this may be changed below...)
   115    115   #
   116    116   USE_AMALGAMATION=1
   117    117   
   118    118   #########

Changes to src/os_unix.c.

    66     66   #if !defined(SQLITE_ENABLE_LOCKING_STYLE)
    67     67   #  if defined(__APPLE__)
    68     68   #    define SQLITE_ENABLE_LOCKING_STYLE 1
    69     69   #  else
    70     70   #    define SQLITE_ENABLE_LOCKING_STYLE 0
    71     71   #  endif
    72     72   #endif
           73  +
           74  +/* Use pread() and pwrite() if they are available */
           75  +#if defined(__APPLE__)
           76  +# define HAVE_PREAD 1
           77  +# define HAVE_PWRITE 1
           78  +#endif
           79  +#if defined(HAVE_PREAD64) && defined(HAVE_PWRITE64)
           80  +# undef USE_PREAD
           81  +# define USE_PREAD64 1
           82  +#elif defined(HAVE_PREAD) && defined(HAVE_PWRITE)
           83  +# undef USE_PREAD64
           84  +# define USE_PREAD 1
           85  +#endif
    73     86   
    74     87   /*
    75     88   ** standard include files.
    76     89   */
    77     90   #include <sys/types.h>
    78     91   #include <sys/stat.h>
    79     92   #include <fcntl.h>