/ Check-in [3a7d7298]
Login

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

Overview
Comment:The last parameter to pread64() and pwrite64() should be off64_t, not off_t.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3a7d72986fabe9434ff5bd02c93169314f072b23
User & Date: drh 2016-04-18 13:09:55
Context
2016-04-18
15:46
Remove quotes from identifiers used as datatype names in a CREATE TABLE statement. Fix for ticket [7d7525cb01b68] check-in: eba27d4d user: drh tags: trunk
13:36
Merge recent trunk changes. check-in: d9768de5 user: drh tags: tempfiles-25
13:09
The last parameter to pread64() and pwrite64() should be off64_t, not off_t. check-in: 3a7d7298 user: drh tags: trunk
2016-04-15
15:03
CLI enhancement: Add the ".eqp full" option, that shows both the EXPLAIN QUERY PLAN and the EXPLAIN output for each command run. Also disable any ".wheretrace" and ".selecttrace" when showing EQP output. check-in: 3e217d62 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

   401    401   #define osPread     ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].pCurrent)
   402    402   
   403    403   #if defined(USE_PREAD64)
   404    404     { "pread64",      (sqlite3_syscall_ptr)pread64,    0  },
   405    405   #else
   406    406     { "pread64",      (sqlite3_syscall_ptr)0,          0  },
   407    407   #endif
   408         -#define osPread64   ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[10].pCurrent)
          408  +#define osPread64 ((ssize_t(*)(int,void*,size_t,off64_t))aSyscall[10].pCurrent)
   409    409   
   410    410     { "write",        (sqlite3_syscall_ptr)write,      0  },
   411    411   #define osWrite     ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)
   412    412   
   413    413   #if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE
   414    414     { "pwrite",       (sqlite3_syscall_ptr)pwrite,     0  },
   415    415   #else
................................................................................
   419    419                       aSyscall[12].pCurrent)
   420    420   
   421    421   #if defined(USE_PREAD64)
   422    422     { "pwrite64",     (sqlite3_syscall_ptr)pwrite64,   0  },
   423    423   #else
   424    424     { "pwrite64",     (sqlite3_syscall_ptr)0,          0  },
   425    425   #endif
   426         -#define osPwrite64  ((ssize_t(*)(int,const void*,size_t,off_t))\
          426  +#define osPwrite64  ((ssize_t(*)(int,const void*,size_t,off64_t))\
   427    427                       aSyscall[13].pCurrent)
   428    428   
   429    429     { "fchmod",       (sqlite3_syscall_ptr)fchmod,          0  },
   430    430   #define osFchmod    ((int(*)(int,mode_t))aSyscall[14].pCurrent)
   431    431   
   432    432   #if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE
   433    433     { "fallocate",    (sqlite3_syscall_ptr)posix_fallocate,  0 },

Changes to src/test_syscall.c.

   104    104   static char *ts_getcwd(char *zPath, size_t nPath);
   105    105   static int ts_stat(const char *zPath, struct stat *p);
   106    106   static int ts_fstat(int fd, struct stat *p);
   107    107   static int ts_ftruncate(int fd, off_t n);
   108    108   static int ts_fcntl(int fd, int cmd, ... );
   109    109   static int ts_read(int fd, void *aBuf, size_t nBuf);
   110    110   static int ts_pread(int fd, void *aBuf, size_t nBuf, off_t off);
   111         -static int ts_pread64(int fd, void *aBuf, size_t nBuf, off_t off);
          111  +/* Note:  pread64() and pwrite64() actually use off64_t as the type on their
          112  +** last parameter.  But that datatype is not defined on many systems 
          113  +** (ex: Mac, OpenBSD).  So substitute a likely equivalent: sqlite3_uint64 */
          114  +static int ts_pread64(int fd, void *aBuf, size_t nBuf, sqlite3_uint64 off);
   112    115   static int ts_write(int fd, const void *aBuf, size_t nBuf);
   113    116   static int ts_pwrite(int fd, const void *aBuf, size_t nBuf, off_t off);
   114         -static int ts_pwrite64(int fd, const void *aBuf, size_t nBuf, off_t off);
          117  +static int ts_pwrite64(int fd, const void *aBuf, size_t nBuf, sqlite3_uint64 off);
   115    118   static int ts_fchmod(int fd, mode_t mode);
   116    119   static int ts_fallocate(int fd, off_t off, off_t len);
   117    120   static void *ts_mmap(void *, size_t, int, int, int, off_t);
   118    121   static void *ts_mremap(void*, size_t, size_t, int, ...);
   119    122   
   120    123   struct TestSyscallArray {
   121    124     const char *zName;
................................................................................
   151    154   #define orig_getcwd    ((char*(*)(char*,size_t))aSyscall[3].xOrig)
   152    155   #define orig_stat      ((int(*)(const char*,struct stat*))aSyscall[4].xOrig)
   153    156   #define orig_fstat     ((int(*)(int,struct stat*))aSyscall[5].xOrig)
   154    157   #define orig_ftruncate ((int(*)(int,off_t))aSyscall[6].xOrig)
   155    158   #define orig_fcntl     ((int(*)(int,int,...))aSyscall[7].xOrig)
   156    159   #define orig_read      ((ssize_t(*)(int,void*,size_t))aSyscall[8].xOrig)
   157    160   #define orig_pread     ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].xOrig)
   158         -#define orig_pread64   ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[10].xOrig)
          161  +#define orig_pread64   ((ssize_t(*)(int,void*,size_t,sqlite3_uint64))aSyscall[10].xOrig)
   159    162   #define orig_write     ((ssize_t(*)(int,const void*,size_t))aSyscall[11].xOrig)
   160    163   #define orig_pwrite    ((ssize_t(*)(int,const void*,size_t,off_t))\
   161    164                          aSyscall[12].xOrig)
   162         -#define orig_pwrite64  ((ssize_t(*)(int,const void*,size_t,off_t))\
          165  +#define orig_pwrite64  ((ssize_t(*)(int,const void*,size_t,sqlite3_uint64))\
   163    166                          aSyscall[13].xOrig)
   164    167   #define orig_fchmod    ((int(*)(int,mode_t))aSyscall[14].xOrig)
   165    168   #define orig_fallocate ((int(*)(int,off_t,off_t))aSyscall[15].xOrig)
   166    169   #define orig_mmap      ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[16].xOrig)
   167    170   #define orig_mremap    ((void*(*)(void*,size_t,size_t,int,...))aSyscall[17].xOrig)
   168    171   
   169    172   /*
................................................................................
   322    325     }
   323    326     return orig_pread(fd, aBuf, nBuf, off);
   324    327   }
   325    328   
   326    329   /*
   327    330   ** A wrapper around pread64().
   328    331   */
   329         -static int ts_pread64(int fd, void *aBuf, size_t nBuf, off_t off){
          332  +static int ts_pread64(int fd, void *aBuf, size_t nBuf, sqlite3_uint64 off){
   330    333     if( tsIsFailErrno("pread64") ){
   331    334       return -1;
   332    335     }
   333    336     return orig_pread64(fd, aBuf, nBuf, off);
   334    337   }
   335    338   
   336    339   /*
................................................................................
   353    356     }
   354    357     return orig_pwrite(fd, aBuf, nBuf, off);
   355    358   }
   356    359   
   357    360   /*
   358    361   ** A wrapper around pwrite64().
   359    362   */
   360         -static int ts_pwrite64(int fd, const void *aBuf, size_t nBuf, off_t off){
          363  +static int ts_pwrite64(int fd, const void *aBuf, size_t nBuf, sqlite3_uint64 off){
   361    364     if( tsIsFailErrno("pwrite64") ){
   362    365       return -1;
   363    366     }
   364    367     return orig_pwrite64(fd, aBuf, nBuf, off);
   365    368   }
   366    369   
   367    370   /*