]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
In os_unix.c, use "IS_VXWORKS" instead of "defined(__RTP__) || defined(_WRS_KERNEL...
authordanielk1977 <danielk1977@noemail.net>
Wed, 19 Nov 2008 13:52:30 +0000 (13:52 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Wed, 19 Nov 2008 13:52:30 +0000 (13:52 +0000)
FossilOrigin-Name: 92c91a6cd7bcbe79206bdf7708fe9049a7b7fdd6

manifest
manifest.uuid
src/os_unix.c

index 8e8551ac36e49590a48c65b4bf36d1fe78260b85..c0ff93c00ece3c019c18c224843419ae5c486687 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Version\snumber\sto\s3.6.6.\s(CVS\s5924)
-D 2008-11-19T12:43:20
+C In\sos_unix.c,\suse\s"IS_VXWORKS"\sinstead\sof\s"defined(__RTP__)\s||\sdefined(_WRS_KERNEL)".\sPurely\sbecause\sit's\seasier\son\sthe\seyes.\s(CVS\s5925)
+D 2008-11-19T13:52:30
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 0aa7bbe3be6acc4045706e3bb3fd0b8f38f4a3b5
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -137,7 +137,7 @@ F src/os.c 0b411644b87ad689d7250bbfd1834d99b81a3df4
 F src/os.h ef8abeb9afc694b82dbd169a91c9b7e26db3c892
 F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60
 F src/os_os2.c d12285d66df674c42f6f544a6f7c21bf1a954ee1
-F src/os_unix.c d8555013e65f0e7ba110823b4b9e7a18080185f5
+F src/os_unix.c 88cfaa018b62a708bee91a984a48a59e56df2bc4
 F src/os_win.c 08d0b059ac01f32e8813bb96fc573486592b83f5
 F src/pager.c ae5da38b6415bdd88e56a2a484f29282c4ea09f5
 F src/pager.h a02ef8e6cc7e78b54874166e5ce786c9d4c489bf
@@ -659,7 +659,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 2f5aaad90b7e3bbb31866c43db3e24a1be26f03b
-R 92f5f81cc0445e7671c6a514671bce05
-U drh
-Z c9990c6e561404196bd0633fad69f3ee
+P 8cc120fb3aed835a2cd081963317b7f1b1ac4b73
+R a60912d7c8bf8ef16c32d0eefce892ef
+U danielk1977
+Z 773ef59016ee6ed7937cc42866024e39
index 83c609cdb0f71e71677ebe70bf08640b1bfe795f..c88e8296bbde5d75c4d88d781d24dfdf88599d73 100644 (file)
@@ -1 +1 @@
-8cc120fb3aed835a2cd081963317b7f1b1ac4b73
\ No newline at end of file
+92c91a6cd7bcbe79206bdf7708fe9049a7b7fdd6
\ No newline at end of file
index 9f538e49589cc5c97e058f45b4782bfc696d6c73..e28cda5d6370ac10a0236f4bb335f582d9545869 100644 (file)
@@ -12,7 +12,7 @@
 **
 ** This file contains code that is specific to Unix systems.
 **
-** $Id: os_unix.c,v 1.213 2008/11/19 11:35:40 danielk1977 Exp $
+** $Id: os_unix.c,v 1.214 2008/11/19 13:52:30 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #if SQLITE_OS_UNIX              /* This file is used on unix only */
 #include <errno.h>
 
 #if SQLITE_ENABLE_LOCKING_STYLE
-#include <sys/ioctl.h>
-#if defined(__RTP__) || defined(_WRS_KERNEL)
-#define lstat stat
-#include <semaphore.h>
-#include <limits.h>
-#else
-#include <sys/param.h>
-#include <sys/mount.h>
-#endif
+# include <sys/ioctl.h>
+# if IS_VXWORKS
+#  define lstat stat
+#  include <semaphore.h>
+#  include <limits.h>
+# else
+#  include <sys/param.h>
+#  include <sys/mount.h>
+# endif
 #endif /* SQLITE_ENABLE_LOCKING_STYLE */
 
 /*
@@ -140,7 +140,7 @@ struct unixFile {
   pthread_t tid;            /* The thread that "owns" this unixFile */
 #endif
   int lastErrno;            /* The unix errno from the last I/O error */
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   int isDelete;             /* Delete on close if true */
   char *zRealpath;
 #endif
@@ -322,7 +322,7 @@ struct unixFile {
 */
 struct lockKey {
   dev_t dev;       /* Device number */
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   void *rnam;      /* Realname since inode unusable */
 #else
   ino_t ino;       /* Inode number */
@@ -356,7 +356,7 @@ struct lockInfo {
 */
 struct openKey {
   dev_t dev;   /* Device number */
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   void *rnam;  /* Realname since inode unusable */
 #else
   ino_t ino;   /* Inode number */
@@ -376,7 +376,7 @@ struct openCnt {
   int nLock;            /* Number of outstanding locks */
   int nPending;         /* Number of pending close() operations */
   int *aPending;        /* Malloced space holding fd's awaiting a close() */
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   sem_t *pSem;          /* Named POSIX semaphore */
   char aSemName[MAX_PATHNAME+1];   /* Name of that semaphore */
 #endif
@@ -392,7 +392,7 @@ struct openCnt {
 static struct lockInfo *lockList = 0;
 static struct openCnt *openList = 0;
 
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
 /*
 ** This hash table is used to bind the canonical file name to a
 ** unixFile structure and use the hash key (= canonical name)
@@ -646,7 +646,7 @@ static void releaseOpenCnt(struct openCnt *pOpen){
   }
 }
 
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
 /*
 ** Implementation of a realpath() like function for vxWorks
 ** to determine canonical path name from given name. It does
@@ -759,13 +759,10 @@ static int testLockingStyle(int fd){
   }
   
   /* Testing for flock() can give false positives.  So if if the above 
-  ** test fails, then we fall back to using dot-file style locking.
+  ** test fails, then we fall back to using dot-file style locking (or
+  ** named-semaphore locking on vxworks).
   */
-#if defined(__RTP__) || defined(_WRS_KERNEL)  
-  return LOCKING_STYLE_NAMEDSEM;
-#else
-  return LOCKING_STYLE_DOTFILE;
-#endif
+  return (IS_VXWORKS ? LOCKING_STYLE_NAMEDSEM : LOCKING_STYLE_DOTFILE);
 }
 #endif
 
@@ -786,7 +783,7 @@ static int detectLockingStyle(
   const char *filePath, 
   int fd
 ){
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   if( !filePath ){
     return LOCKING_STYLE_NONE;
   }
@@ -836,7 +833,7 @@ static int detectLockingStyle(
 
   /* Default case. Handles, amongst others, "nfs". */
   return testLockingStyle(fd);  
-#endif /* if defined(__RTP__) || defined(_WRS_KERNEL) */
+#endif /* if IS_VXWORKS */
   return LOCKING_STYLE_POSIX;
 }
 #else
@@ -852,7 +849,7 @@ static int detectLockingStyle(
 */
 static int findLockInfo(
   int fd,                      /* The file descriptor used in the key */
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   void *rnam,                  /* vxWorks realname */
 #endif
   struct lockInfo **ppLock,    /* Return the lockInfo structure here */
@@ -892,7 +889,7 @@ static int findLockInfo(
 
   memset(&key1, 0, sizeof(key1));
   key1.dev = statbuf.st_dev;
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   key1.rnam = rnam;
 #else
   key1.ino = statbuf.st_ino;
@@ -905,7 +902,7 @@ static int findLockInfo(
 #endif
   memset(&key2, 0, sizeof(key2));
   key2.dev = statbuf.st_dev;
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   key2.rnam = rnam;
 #else
   key2.ino = statbuf.st_ino;
@@ -953,7 +950,7 @@ static int findLockInfo(
       pOpen->pPrev = 0;
       if( openList ) openList->pPrev = pOpen;
       openList = pOpen;
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
       pOpen->pSem = NULL;
       pOpen->aSemName[0] = '\0';
 #endif
@@ -1021,7 +1018,7 @@ static int transferOwnership(unixFile *pFile){
   pFile->tid = hSelf;
   if (pFile->pLock != NULL) {
     releaseLockInfo(pFile->pLock);
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
     rc = findLockInfo(pFile->h, pFile->zRealpath, &pFile->pLock, 0);
 #else
     rc = findLockInfo(pFile->h, &pFile->pLock, 0);
@@ -1841,7 +1838,7 @@ static int closeUnixFile(sqlite3_file *id){
     if( pFile->h>=0 ){
       close(pFile->h);
     }
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
     if( pFile->isDelete && pFile->zRealpath ){
       unlink(pFile->zRealpath);
     }
@@ -1904,7 +1901,7 @@ static int unixClose(sqlite3_file *id){
 
 #if SQLITE_ENABLE_LOCKING_STYLE
 
-#if !defined(__RTP__) && !defined(_WRS_KERNEL)
+#if !IS_VXWORKS
 #pragma mark AFP Support
 
 /*
@@ -2352,7 +2349,7 @@ static int flockClose(sqlite3_file *id) {
   return closeUnixFile(id);
 }
 
-#endif /* !defined(__RTP__) && !defined(_WRS_KERNEL) */
+#endif /* !IS_VXWORKS */
 
 #pragma mark Old-School .lock file based locking
 
@@ -2405,7 +2402,7 @@ static int dotlockLock(sqlite3_file *id, int locktype) {
   ** Just adjust level and punt on outta here. */
   if (pFile->locktype > NO_LOCK) {
     pFile->locktype = locktype;
-#if !defined(__RTP__) && !defined(_WRS_KERNEL)    
+#if !IS_VXWORKS
     /* Always update the timestamp on the old file */
     utimes(zLockFile, NULL);
 #endif
@@ -2483,25 +2480,19 @@ static int dotlockUnlock(sqlite3_file *id, int locktype) {
  ** Close a file.
  */
 static int dotlockClose(sqlite3_file *id) {
-#if defined(__RTP__) || defined(_WRS_KERNEL)
   int rc;
-#endif
   if( id ){
     unixFile *pFile = (unixFile*)id;
     dotlockUnlock(id, NO_LOCK);
     sqlite3_free(pFile->lockingContext);
   }
-#if defined(__RTP__) || defined(_WRS_KERNEL)
-  enterMutex();
+  if( IS_VXWORKS ) enterMutex();
   rc = closeUnixFile(id);
-  leaveMutex();
+  if( IS_VXWORKS ) leaveMutex();
   return rc;
-#else
-  return closeUnixFile(id);
-#endif
 }
 
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
 
 #pragma mark POSIX/vxWorks named semaphore based locking
 
@@ -2624,7 +2615,7 @@ static int namedsemClose(sqlite3_file *id) {
   return SQLITE_OK;
 }
 
-#endif /* defined(__RTP__) || defined(_WRS_KERNEL) */
+#endif /* IS_VXWORKS */
 
 #endif /* SQLITE_ENABLE_LOCKING_STYLE */
 
@@ -2743,7 +2734,7 @@ static int fillInUnixFile(
    ,IOMETHODS(nolockClose, nolockLock, nolockUnlock, nolockCheckReservedLock)
 #if SQLITE_ENABLE_LOCKING_STYLE
    ,IOMETHODS(dotlockClose, dotlockLock, dotlockUnlock,dotlockCheckReservedLock)
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
    ,IOMETHODS(nolockClose, nolockLock, nolockUnlock, nolockCheckReservedLock)
    ,IOMETHODS(nolockClose, nolockLock, nolockUnlock, nolockCheckReservedLock)
    ,IOMETHODS(namedsemClose, namedsemLock, namedsemUnlock, namedsemCheckReservedLock)
@@ -2772,7 +2763,7 @@ static int fillInUnixFile(
   pNew->dirfd = dirfd;
   SET_THREADID(pNew);
 
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   {
     HashElem *pElem;
     char *zRealname = vxrealpath(zFilename, 1);
@@ -2818,7 +2809,7 @@ static int fillInUnixFile(
 
     case LOCKING_STYLE_POSIX: {
       enterMutex();
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
       rc = findLockInfo(h, pNew->zRealpath, &pNew->pLock, &pNew->pOpen);
 #else
       rc = findLockInfo(h, &pNew->pLock, &pNew->pOpen);
@@ -2829,7 +2820,7 @@ static int fillInUnixFile(
 
 #if SQLITE_ENABLE_LOCKING_STYLE
 
-#if !defined(__RTP__) && !defined(_WRS_KERNEL)
+#if !IS_VXWORKS
     case LOCKING_STYLE_AFP: {
       /* AFP locking uses the file path so it needs to be included in
       ** the afpLockingContext.
@@ -2866,7 +2857,7 @@ static int fillInUnixFile(
       break;
     }
 
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
     case LOCKING_STYLE_NAMEDSEM: {
       /* Named semaphore locking uses the file path so it needs to be
       ** included in the namedsemLockingContext
@@ -2890,7 +2881,7 @@ static int fillInUnixFile(
     }
 #endif
 
-#if !defined(__RTP__) && !defined(_WRS_KERNEL)
+#if !IS_VXWORKS
     case LOCKING_STYLE_FLOCK: 
 #endif
     case LOCKING_STYLE_NONE: 
@@ -2899,7 +2890,7 @@ static int fillInUnixFile(
   }
   
   pNew->lastErrno = 0;
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   if( rc!=SQLITE_OK ){
     unlink(zFilename);
     isDelete = 0;
@@ -3115,7 +3106,7 @@ static int unixOpen(
     return SQLITE_CANTOPEN;
   }
   if( isDelete ){
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
     zPath = zName;
 #else
     unlink(zName);
@@ -3156,7 +3147,7 @@ static int unixDelete(sqlite3_vfs *NotUsed, const char *zPath, int dirSync){
     int fd;
     rc = openDirectory(zPath, &fd);
     if( rc==SQLITE_OK ){
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
       if( fsync(fd)==-1 )
 #else
       if( fsync(fd) )
@@ -3234,7 +3225,7 @@ static int unixFullPathname(
 
   assert( pVfs->mxPathname==MAX_PATHNAME );
 
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   {
     char *zRealname = vxrealpath(zPath, 0);
     zOut[0] = '\0';
@@ -3382,7 +3373,7 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){
 ** than the argument.
 */
 static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   struct timespec sp;
 
   sp.tv_sec = microseconds / 1000000;
@@ -3414,7 +3405,7 @@ int sqlite3_current_time = 0;
 ** return 0.  Return 1 if the time and date cannot be found.
 */
 static int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   struct timespec sNow;
   clock_gettime(CLOCK_REALTIME, &sNow);
   *prNow = 2440587.5 + sNow.tv_sec/86400.0 + sNow.tv_nsec/86400000000000.0;
@@ -3489,7 +3480,7 @@ int sqlite3_os_init(void){
     sqlite3_vfs_register(&aVfs[i], 0);
   }
 #endif
-#if defined(__RTP__) || defined(_WRS_KERNEL)
+#if IS_VXWORKS
   sqlite3HashInit(&nameHash, 1);
 #endif
   sqlite3_vfs_register(&unixVfs, 1);