Fix the build for cases when pread()/pwrite() are not available.

FossilOrigin-Name: 7d67d876b70c7a4199697c5b112d809c600e140e
This commit is contained in:
drh 2016-03-04 03:02:06 +00:00
parent e32a256acd
commit a46cadc42e
3 changed files with 17 additions and 21 deletions

View File

@ -1,5 +1,5 @@
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
C Fix\sthe\sbuild\sfor\scases\swhen\spread()/pwrite()\sare\snot\savailable.
D 2016-03-04T03:02:06.930
F Makefile.in e335453db0b16da00c884ad51bb56d1c091a74de
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc dbd4621ecc585c2ef0c2aa0874698c54675754f1
@ -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 a1aaf2d8d253138e63d2a8a972693f9f624f885d
F src/os_unix.c 14a28aeb3b77102a90ed645534a8d319b8ac6082
F src/os_win.c f0d7aa603eb6262143d7169a222aea07c4fca91d
F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca
F src/pager.c d034c69b958c01289eb8070cbf902e1a68cd7e0b
@ -1453,7 +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 16fbf2e19c22df9441aef5c8b7f5670adc38a6b6
R 8390ec5e0d9e5eb3999e5eee0cb5ce81
P 2cffb9e50bed77d1079603f5b4a71b7559de7294
R 340d2ced6d6364f0299bbd36b34b2f41
U drh
Z b764ac5f33b779f6bf5d09a763220c12
Z a704f390d3e95dbf657db754d417ef5a

View File

@ -1 +1 @@
2cffb9e50bed77d1079603f5b4a71b7559de7294
7d67d876b70c7a4199697c5b112d809c600e140e

View File

@ -84,7 +84,6 @@
# define USE_PWRITE64 1
#endif
/*
** standard include files.
*/
@ -214,9 +213,6 @@ 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 */
@ -3114,6 +3110,9 @@ 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 );
@ -3125,15 +3124,13 @@ static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){
got = osPread64(id->h, pBuf, cnt, offset);
SimulateIOError( got = -1 );
#else
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;
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);
#endif
if( got==cnt ) break;
if( got<0 ){
@ -3239,7 +3236,6 @@ 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 ){