From 84cf05349fa3e106a498dc479f44bbd0cc402f2a Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 21 Oct 2009 14:14:18 +1000 Subject: VXWorks changes. Forward port the vxworks changes from d7b688870aead912690188b324d370b920a7a600 --- src/3rdparty/sqlite/sqlite3.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c index 90a64ba..46d3dfc 100644 --- a/src/3rdparty/sqlite/sqlite3.c +++ b/src/3rdparty/sqlite/sqlite3.c @@ -420,7 +420,7 @@ ** ** See also ticket #2741. */ -#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE +#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE && !defined(VXWORKS) # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ #endif @@ -564,6 +564,13 @@ SQLITE_PRIVATE void sqlite3Coverage(int); */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ + +#ifdef VXWORKS +# define SQLITE_HOMEGROWN_RECURSIVE_MUTEX +# define NO_GETTOD +# include +#endif + #include /* Needed for the definition of va_list */ /* @@ -21470,7 +21477,11 @@ SQLITE_API int sqlite3_os_end(void){ #include #include #include -#include +#ifdef VXWORKS +# include +#else +# include +#endif #include #if SQLITE_ENABLE_LOCKING_STYLE @@ -24411,7 +24422,11 @@ static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){ } return -1; } - got = write(id->h, pBuf, cnt); +# ifndef VXWORKS + got = write(id->h, pBuf, cnt); +# else + got = write(id->h, (char *)pBuf, cnt); +# endif #endif TIMER_END; if( got<0 ){ @@ -25808,12 +25823,16 @@ static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){ #if !defined(SQLITE_TEST) { int pid, fd; - fd = open("/dev/urandom", O_RDONLY); + fd = open("/dev/urandom", O_RDONLY, 0); if( fd<0 ){ time_t t; time(&t); memcpy(zBuf, &t, sizeof(t)); - pid = getpid(); +#ifndef VXWORKS + pid = getpid(); +#else + pid = (int)taskIdCurrent(); +#endif memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid)); assert( sizeof(t)+sizeof(pid)<=(size_t)nBuf ); nBuf = sizeof(t) + sizeof(pid); -- cgit v0.12