/ Check-in [75cd41ff]
Login

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

Overview
Comment:Various #ifdef enhancements for improved VxWorks support.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:75cd41ff179e29c5d45f9d7fed784bc339e0d7a0
User & Date: drh 2016-01-12 00:37:55
Context
2016-01-12
02:00
Fix an uninitialized field in the Select object when SELECTTRACE is enabled. check-in: fc628516 user: drh tags: trunk
00:37
Various #ifdef enhancements for improved VxWorks support. check-in: 75cd41ff user: drh tags: trunk
2016-01-11
22:58
Performance optimization in the sqlite3VdbeChangeP4() routine of the code generator. check-in: 28bd8d5f user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/os_unix.c.

   426    426   
   427    427     { "mkdir",        (sqlite3_syscall_ptr)mkdir,           0 },
   428    428   #define osMkdir     ((int(*)(const char*,mode_t))aSyscall[18].pCurrent)
   429    429   
   430    430     { "rmdir",        (sqlite3_syscall_ptr)rmdir,           0 },
   431    431   #define osRmdir     ((int(*)(const char*))aSyscall[19].pCurrent)
   432    432   
          433  +#if defined(HAVE_FCHOWN)
   433    434     { "fchown",       (sqlite3_syscall_ptr)fchown,          0 },
          435  +#else
          436  +  { "fchown",       (sqlite3_syscall_ptr)0,               0 },
          437  +#endif
   434    438   #define osFchown    ((int(*)(int,uid_t,gid_t))aSyscall[20].pCurrent)
   435    439   
   436    440     { "geteuid",      (sqlite3_syscall_ptr)geteuid,         0 },
   437    441   #define osGeteuid   ((uid_t(*)(void))aSyscall[21].pCurrent)
   438    442   
   439    443   #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
   440    444     { "mmap",         (sqlite3_syscall_ptr)mmap,            0 },
................................................................................
   460    464   #if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
   461    465     { "getpagesize",  (sqlite3_syscall_ptr)unixGetpagesize, 0 },
   462    466   #else
   463    467     { "getpagesize",  (sqlite3_syscall_ptr)0,               0 },
   464    468   #endif
   465    469   #define osGetpagesize ((int(*)(void))aSyscall[25].pCurrent)
   466    470   
          471  +#if defined(HAVE_READLINK)
   467    472     { "readlink",     (sqlite3_syscall_ptr)readlink,        0 },
          473  +#else
          474  +  { "readlink",     (sqlite3_syscall_ptr)0,               0 },
          475  +#endif
   468    476   #define osReadlink ((ssize_t(*)(const char*,char*,size_t))aSyscall[26].pCurrent)
   469    477   
   470    478   
   471    479   }; /* End of the overrideable system calls */
   472    480   
   473    481   
   474    482   /*
   475    483   ** On some systems, calls to fchown() will trigger a message in a security
   476    484   ** log if they come from non-root processes.  So avoid calling fchown() if
   477    485   ** we are not running as root.
   478    486   */
   479    487   static int robustFchown(int fd, uid_t uid, gid_t gid){
   480         -#if OS_VXWORKS
   481         -  return 0;
   482         -#else
          488  +#if defined(HAVE_FCHOWN)
   483    489     return osGeteuid() ? 0 : osFchown(fd,uid,gid);
          490  +#else
          491  +  return 0;
   484    492   #endif
   485    493   }
   486    494   
   487    495   /*
   488    496   ** This is the xSetSystemCall() method of sqlite3_vfs for all of the
   489    497   ** "unix" VFSes.  Return SQLITE_OK opon successfully updating the
   490    498   ** system call pointer, or SQLITE_NOTFOUND if there is no configurable
................................................................................
  5943   5951     ** current working directory has been unlinked.
  5944   5952     */
  5945   5953     SimulateIOError( return SQLITE_ERROR );
  5946   5954   
  5947   5955     assert( pVfs->mxPathname==MAX_PATHNAME );
  5948   5956     UNUSED_PARAMETER(pVfs);
  5949   5957   
         5958  +#if defined(HAVE_READLINK)
  5950   5959     /* Attempt to resolve the path as if it were a symbolic link. If it is
  5951   5960     ** a symbolic link, the resolved path is stored in buffer zOut[]. Or, if
  5952   5961     ** the identified file is not a symbolic link or does not exist, then
  5953   5962     ** zPath is copied directly into zOut. Either way, nByte is left set to
  5954   5963     ** the size of the string copied into zOut[] in bytes.  */
  5955   5964     nByte = osReadlink(zPath, zOut, nOut-1);
  5956   5965     if( nByte<0 ){
................................................................................
  5958   5967         return unixLogError(SQLITE_CANTOPEN_BKPT, "readlink", zPath);
  5959   5968       }
  5960   5969       sqlite3_snprintf(nOut, zOut, "%s", zPath);
  5961   5970       nByte = sqlite3Strlen30(zOut);
  5962   5971     }else{
  5963   5972       zOut[nByte] = '\0';
  5964   5973     }
         5974  +#endif
  5965   5975   
  5966   5976     /* If buffer zOut[] now contains an absolute path there is nothing more
  5967   5977     ** to do. If it contains a relative path, do the following:
  5968   5978     **
  5969   5979     **   * move the relative path string so that it is at the end of th
  5970   5980     **     zOut[] buffer.
  5971   5981     **   * Call getcwd() to read the path of the current working directory 

Changes to src/vxworks.h.

    22     22   #define SQLITE_HOMEGROWN_RECURSIVE_MUTEX 1
    23     23   #define SQLITE_OMIT_LOAD_EXTENSION 1
    24     24   #define SQLITE_ENABLE_LOCKING_STYLE 0
    25     25   #define HAVE_UTIME 1
    26     26   #else
    27     27   /* This is not VxWorks. */
    28     28   #define OS_VXWORKS 0
           29  +#define HAVE_FCHOWN 1
           30  +#define HAVE_READLINK 1
    29     31   #endif /* defined(_WRS_KERNEL) */