> From: drhsql...@gmail.com [mailto:drhsql...@gmail.com] On Behalf Of Richard 
> Hipp
> Sent: 12 August 2014 14:28
> To: Andy Ling
> On Tue, Aug 12, 2014 at 9:23 AM, Andy Ling <andy.l...@quantel.com> wrote:


>> I have been testing
>> the changes Jan has made and at the moment I am happy.


> But we cannot use Jan's changes directly because he lives in a jurisdiction 
> that does not
> recognize the ability of an author to contribute their work into the public 
> domain.  We can
> only use Jan's changes as a guideline for implementing our own changes.
> Do you have any issues with the current code on the tip of trunk?

The patches I applied to 3.8.5 are working OK.
I've lost track a bit of what code I'm running and what I need to download.
So I've just downloaded the latest pre-release 
sqlite-amalgamation-201408081749.zip
and applied the patches below. This builds, but I haven't had a chance to do any
testing yet. Hopefully this matches the changes Jan suggested.

Regards

Andy Ling


*** sqlite3.c   2014-08-08 13:50:06.000000000 +0100
--- sqlite3vxw.c        2014-08-12 15:21:22.000000000 +0100
***************
*** 24161,24167 ****
  #endif


! #if SQLITE_ENABLE_LOCKING_STYLE
  # include <sys/ioctl.h>
  # if OS_VXWORKS
  #  include <semaphore.h>
--- 24161,24167 ----
  #endif


! #if SQLITE_ENABLE_LOCKING_STYLE || OS_VXWORKS
  # include <sys/ioctl.h>
  # if OS_VXWORKS
  #  include <semaphore.h>
***************
*** 24589,24595 ****
--- 24589,24599 ----
  ** we are not running as root.
  */
  static int posixFchown(int fd, uid_t uid, gid_t gid){
+ #if OS_VXWORKS
+   return 0;
+ #else
    return geteuid() ? 0 : fchown(fd,uid,gid);
+ #endif
  }

  /* Forward reference */
***************
*** 24645,24651 ****
    { "read",         (sqlite3_syscall_ptr)read,       0  },
  #define osRead      ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent)

! #if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE
    { "pread",        (sqlite3_syscall_ptr)pread,      0  },
  #else
    { "pread",        (sqlite3_syscall_ptr)0,          0  },
--- 24649,24655 ----
    { "read",         (sqlite3_syscall_ptr)read,       0  },
  #define osRead      ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent)

! #if defined(USE_PREAD) || (SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS)
    { "pread",        (sqlite3_syscall_ptr)pread,      0  },
  #else
    { "pread",        (sqlite3_syscall_ptr)0,          0  },
***************
*** 24662,24668 ****
    { "write",        (sqlite3_syscall_ptr)write,      0  },
  #define osWrite     ((ssize_t(*)(int,const 
void*,size_t))aSyscall[11].pCurrent)

! #if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE
    { "pwrite",       (sqlite3_syscall_ptr)pwrite,     0  },
  #else
    { "pwrite",       (sqlite3_syscall_ptr)0,          0  },
--- 24666,24672 ----
    { "write",        (sqlite3_syscall_ptr)write,      0  },
  #define osWrite     ((ssize_t(*)(int,const 
void*,size_t))aSyscall[11].pCurrent)

! #if defined(USE_PREAD) || (SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS)
    { "pwrite",       (sqlite3_syscall_ptr)pwrite,     0  },
  #else
    { "pwrite",       (sqlite3_syscall_ptr)0,          0  },
***************
*** 25564,25572 ****
--- 25568,25582 ----
  ** Return TRUE if pFile has been renamed or unlinked since it was first 
opened.
  */
  static int fileHasMoved(unixFile *pFile){
+ #if OS_VXWORKS
+   return pFile->pInode!=0 &&
+
+          pFile->pId!=pFile->pInode->fileId.pId;
+ #else
    struct stat buf;
    return pFile->pInode!=0 &&
           (osStat(pFile->zPath, &buf)!=0 || 
buf.st_ino!=pFile->pInode->fileId.ino);
+ #endif
  }


***************
*** 26709,26715 ****
    /* Otherwise see if some other process holds it. */
    if( !reserved ){
      sem_t *pSem = pFile->pInode->pSem;
-     struct stat statBuf;

      if( sem_trywait(pSem)==-1 ){
        int tErrno = errno;
--- 26719,26724 ----
***************
*** 26762,26768 ****
  */
  static int semLock(sqlite3_file *id, int eFileLock) {
    unixFile *pFile = (unixFile*)id;
-   int fd;
    sem_t *pSem = pFile->pInode->pSem;
    int rc = SQLITE_OK;

--- 26771,26776 ----
***************
*** 29893,29902 ****
    int isCreate     = (flags & SQLITE_OPEN_CREATE);
    int isReadonly   = (flags & SQLITE_OPEN_READONLY);
    int isReadWrite  = (flags & SQLITE_OPEN_READWRITE);
! #if SQLITE_ENABLE_LOCKING_STYLE
    int isAutoProxy  = (flags & SQLITE_OPEN_AUTOPROXY);
  #endif
! #if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
    struct statfs fsInfo;
  #endif

--- 29901,29910 ----
    int isCreate     = (flags & SQLITE_OPEN_CREATE);
    int isReadonly   = (flags & SQLITE_OPEN_READONLY);
    int isReadWrite  = (flags & SQLITE_OPEN_READWRITE);
! #if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS
    int isAutoProxy  = (flags & SQLITE_OPEN_AUTOPROXY);
  #endif
! #if defined(__APPLE__) || (SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS)
    struct statfs fsInfo;
  #endif

***************
*** 30062,30068 ****
    noLock = eType!=SQLITE_OPEN_MAIN_DB;


! #if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE
    if( fstatfs(fd, &fsInfo) == -1 ){
      ((unixFile*)pFile)->lastErrno = errno;
      robust_close(p, fd, __LINE__);
--- 30070,30076 ----
    noLock = eType!=SQLITE_OPEN_MAIN_DB;


! #if defined(__APPLE__) || (SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS)
    if( fstatfs(fd, &fsInfo) == -1 ){
      ((unixFile*)pFile)->lastErrno = errno;
      robust_close(p, fd, __LINE__);
***************
*** 30080,30086 ****
    if( syncDir )                 ctrlFlags |= UNIXFILE_DIRSYNC;
    if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI;

! #if SQLITE_ENABLE_LOCKING_STYLE
  #if SQLITE_PREFER_PROXY_LOCKING
    isAutoProxy = 1;
  #endif
--- 30088,30094 ----
    if( syncDir )                 ctrlFlags |= UNIXFILE_DIRSYNC;
    if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI;

! #if defined(__APPLE__) || (SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS)
  #if SQLITE_PREFER_PROXY_LOCKING
    isAutoProxy = 1;
  #endif
***************
*** 30151,30156 ****
--- 30159,30168 ----
    if( osUnlink(zPath)==(-1) ){
      if( errno==ENOENT ){
        rc = SQLITE_IOERR_DELETE_NOENT;
+ #if OS_VXWORKS
+     }else if( errno==0x380003 ){ /* == S_dosFsLib_FILE_NOT_FOUND */
+       rc = SQLITE_IOERR_DELETE_NOENT;
+ #endif
      }else{
        rc = unixLogError(SQLITE_IOERR_DELETE, "unlink", zPath);
      }


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to