-C Add\slarge\sfile\ssupport\sto\sWindows.\s\sChange\slarge\sfile\ssupport\sfor\sUnix\sso\nthat\sit\scompiles\sautomatically\s-\swithout\srequiring\sspecial\soptions\son\sthe\ncompiler\scommand\sline.\s(CVS\s781)
-D 2002-11-06T14:08:11
+C Try\sto\sbetter\sdetect\swhen\sthe\slibrary\sis\scompiled\sfor\slarge\sfile\ssupport\s(LFS)\nbut\sthe\ssupport\sis\snot\savailable\sin\sthe\shost\sOS\skernel.\s(CVS\s782)
+D 2002-11-09T00:33:16
F Makefile.in d6c9a85c2a5e696843201d090dcf8bf2f8716f2a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
F src/hash.c 6a6236b89c8c060c65dabd300a1c8ce7c10edb72
F src/hash.h cd0433998bc1a3759d244e1637fe5a3c13b53bf8
F src/insert.c 764300a0bd8074a2174946c0bf8a550bd833397a
-F src/main.c b95d7eeec90f86d05b6a064d07db34b7279e06d4
+F src/main.c f04f93b8928d6d85976e5137fea146a46de1fd6e
F src/md5.c fe4f9c9c6f71dfc26af8da63e4d04489b1430565
-F src/os.c ebe65e9a1c88535e367aaaae25ef087c1486b08d
-F src/os.h deac8efeac7767de931122c536ca253fdb70f2f8
-F src/pager.c 7d581b201d7284fa9dafde92cd5b737e3733c984
+F src/os.c caf5a34b35a2d99a58457517261c879ac29b0a05
+F src/os.h 1caaea972d1c0401cfe6300aba51fb0f6fe435c9
+F src/pager.c 292853d08658df23f1044fba1a793a210475964e
F src/pager.h 6991c9c2dc5e4c7f2df4d4ba47d1c6458f763a32
F src/parse.y 469c9636ff713e63c00234662209f11668671ae9
F src/printf.c 5c50fc1da75c8f5bf432b1ad17d91d6653acd167
F src/select.c ce82596a2eaaf418edba45b2426f41065e49578b
F src/shell.c 9e9a6eb6bca07f01e6472a603f908a0127ea50ff
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
-F src/sqlite.h.in d3999a9c6374675779058d6cfe5431131618e92b
+F src/sqlite.h.in 98b1574b2362abe02c4a4c73b9dbf99bcd713ab3
F src/sqliteInt.h a001c52dfb10ec38f18d6b9ed7dd8b3f42ca8c72
F src/table.c eed2098c9b577aa17f8abe89313a9c4413f57d63
F src/tclsqlite.c 9f2c00a92338c51171ded8943bd42d77f7e69e64
F src/test1.c a46e9f61915b32787c5d5a05a4b92e4dacc437d9
-F src/test2.c 5fa694d130b3309e3f9c852f0a437750fcb5a006
+F src/test2.c 8f7d88895a49b3eed111469f2ab1071cb780ed12
F src/test3.c 540fa7fc3cb3732517b779b5f90ad9cc4303d0ab
F src/threadtest.c d641a5219e718e18a1a80a50eb9bb549f451f42e
F src/tokenize.c 75e3bb37305b64e118e709752066f494c4f93c30
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
-P 81bb1aed5e9094a9655bd03614bb111d79896928
-R 2170efe21354495bba0abb7d147e0a86
+P 2008b56fe11e49d52e28f47d14ccd70504e6c094
+R 4ac4711a79ff9ee10d8741795898da69
U drh
-Z 7e2f109564ef517cfa10eb3df7a02ba0
+Z c8abc0129b7b7c57014c7437e465381e
-2008b56fe11e49d52e28f47d14ccd70504e6c094
\ No newline at end of file
+a29d60ecc5ee3f535142a81f56eecbef7875ef22
\ No newline at end of file
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
-** $Id: main.c,v 1.103 2002/11/01 01:55:37 drh Exp $
+** $Id: main.c,v 1.104 2002/11/09 00:33:16 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
case SQLITE_CONSTRAINT: z = "constraint failed"; break;
case SQLITE_MISMATCH: z = "datatype mismatch"; break;
case SQLITE_MISUSE: z = "library routine called out of sequence";break;
+ case SQLITE_NOLFS: z = "kernel lacks large file support"; break;
default: z = "unknown error"; break;
}
return z;
#if OS_UNIX
# include <time.h>
+# include <errno.h>
# ifndef O_LARGEFILE
# define O_LARGEFILE 0
# endif
+# ifdef SQLITE_DISABLE_LFS
+# undef O_LARGEFILE
+# define O_LARGEFILE 0
+# endif
# ifndef O_NOFOLLOW
# define O_NOFOLLOW 0
# endif
** If the file was write locked, then this reduces the lock to a read.
** If the file was read locked, then this acquires a new read lock.
**
-** Return SQLITE_OK on success and SQLITE_BUSY on failure.
+** Return SQLITE_OK on success and SQLITE_BUSY on failure. If this
+** library was compiled with large file support (LFS) but LFS is not
+** available on the host, then an SQLITE_NOLFS is returned.
*/
int sqliteOsReadLock(OsFile *id){
#if OS_UNIX
rc = SQLITE_OK;
}else if( id->locked || id->pLock->cnt==0 ){
struct flock lock;
+ int s;
lock.l_type = F_RDLCK;
lock.l_whence = SEEK_SET;
lock.l_start = lock.l_len = 0L;
- if( fcntl(id->fd, F_SETLK, &lock)!=0 ){
- rc = SQLITE_BUSY;
+ s = fcntl(id->fd, F_SETLK, &lock);
+ if( s!=0 ){
+ rc = (s==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
}else{
rc = SQLITE_OK;
id->pLock->cnt = 1;
/*
** Change the lock status to be an exclusive or write lock. Return
-** SQLITE_OK on success and SQLITE_BUSY on a failure.
+** SQLITE_OK on success and SQLITE_BUSY on a failure. If this
+** library was compiled with large file support (LFS) but LFS is not
+** available on the host, then an SQLITE_NOLFS is returned.
*/
int sqliteOsWriteLock(OsFile *id){
#if OS_UNIX
sqliteOsEnterMutex();
if( id->pLock->cnt==0 || (id->pLock->cnt==1 && id->locked==1) ){
struct flock lock;
+ int s;
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
lock.l_start = lock.l_len = 0L;
- if( fcntl(id->fd, F_SETLK, &lock)!=0 ){
- rc = SQLITE_BUSY;
+ s = fcntl(id->fd, F_SETLK, &lock);
+ if( s!=0 ){
+ rc = (s==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
}else{
rc = SQLITE_OK;
id->pLock->cnt = -1;
/*
** Unlock the given file descriptor. If the file descriptor was
-** not previously locked, then this routine is a no-op.
+** not previously locked, then this routine is a no-op. If this
+** library was compiled with large file support (LFS) but LFS is not
+** available on the host, then an SQLITE_NOLFS is returned.
*/
int sqliteOsUnlock(OsFile *id){
#if OS_UNIX
rc = SQLITE_OK;
}else{
struct flock lock;
+ int s;
lock.l_type = F_UNLCK;
lock.l_whence = SEEK_SET;
lock.l_start = lock.l_len = 0L;
- if( fcntl(id->fd, F_SETLK, &lock)!=0 ){
- rc = SQLITE_BUSY;
+ s = fcntl(id->fd, F_SETLK, &lock);
+ if( s!=0 ){
+ rc = (s==EINVAL) ? SQLITE_NOLFS : SQLITE_BUSY;
}else{
rc = SQLITE_OK;
id->pLock->cnt = 0;
** These #defines should enable >2GB file support on Posix if the
** underlying operating system supports it. If the OS lacks
** large file support, or if the OS is windows, these should be no-ops.
+**
+** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch
+** on the compiler command line. This is necessary if you are compiling
+** on a recent machine (ex: RedHat 7.2) but you want your code to work
+** on an older machine (ex: RedHat 6.0). If you compile on RedHat 7.2
+** without this option, LFS is enable. But LFS does not exist in the kernel
+** in RedHat 6.0, so the code won't work. Hence, for maximum binary
+** portability you should omit LFS.
*/
-#define _LARGE_FILE 1
-#define _FILE_OFFSET_BITS 64
-#define _LARGEFILE_SOURCE 1
+#ifndef SQLITE_DISABLE_LFS
+# define _LARGE_FILE 1
+# define _FILE_OFFSET_BITS 64
+# define _LARGEFILE_SOURCE 1
+#endif
/*
** Figure out if we are dealing with Unix or Windows.
** file simultaneously, or one process from reading the database while
** another is writing.
**
-** @(#) $Id: pager.c,v 1.55 2002/11/06 14:08:11 drh Exp $
+** @(#) $Id: pager.c,v 1.56 2002/11/09 00:33:16 drh Exp $
*/
#include "os.h" /* Must be first to enable large file support */
#include "sqliteInt.h"
*/
int sqlitepager_get(Pager *pPager, Pgno pgno, void **ppPage){
PgHdr *pPg;
+ int rc;
/* Make sure we have not hit any critical errors.
*/
** on the database file.
*/
if( pPager->nRef==0 ){
- if( sqliteOsReadLock(&pPager->fd)!=SQLITE_OK ){
+ rc = sqliteOsReadLock(&pPager->fd);
+ if( rc!=SQLITE_OK ){
*ppPage = 0;
- return SQLITE_BUSY;
+ return rc;
}
pPager->state = SQLITE_READLOCK;
*/
rc = sqliteOsWriteLock(&pPager->fd);
if( rc!=SQLITE_OK ){
- rc = sqliteOsUnlock(&pPager->fd);
- assert( rc==SQLITE_OK );
+ if( sqliteOsUnlock(&pPager->fd)!=SQLITE_OK ){
+ /* This should never happen! */
+ rc = SQLITE_INTERNAL;
+ }
*ppPage = 0;
- return SQLITE_BUSY;
+ return rc;
}
pPager->state = SQLITE_WRITELOCK;
** This header file defines the interface that the SQLite library
** presents to client programs.
**
-** @(#) $Id: sqlite.h.in,v 1.34 2002/07/30 17:20:40 drh Exp $
+** @(#) $Id: sqlite.h.in,v 1.35 2002/11/09 00:33:17 drh Exp $
*/
#ifndef _SQLITE_H_
#define _SQLITE_H_
#define SQLITE_CONSTRAINT 19 /* Abort due to contraint violation */
#define SQLITE_MISMATCH 20 /* Data type mismatch */
#define SQLITE_MISUSE 21 /* Library used incorrectly */
+#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
/*
** Each entry in an SQLite table has a unique integer key. (The key is
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test2.c,v 1.10 2002/08/31 18:53:08 drh Exp $
+** $Id: test2.c,v 1.11 2002/11/09 00:33:17 drh Exp $
*/
#include "sqliteInt.h"
#include "pager.h"
case SQLITE_CONSTRAINT: zName = "SQLITE_CONSTRAINT"; break;
case SQLITE_MISMATCH: zName = "SQLITE_MISMATCH"; break;
case SQLITE_MISUSE: zName = "SQLITE_MISUSE"; break;
+ case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break;
default: zName = "SQLITE_Unknown"; break;
}
return zName;