summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2011-07-19 11:22:59 +1000
committerQt by Nokia <qt-info@nokia.com>2011-07-21 03:53:53 +0200
commit968b54ff8991de73ac97874351b57be3efd4f0e9 (patch)
treeafcd4b7f7f85800045ba2f171108ccb22a13b1f1 /src
parentce3aaf38aae8abd2a92751bada87a627f07ea2b4 (diff)
Forward port the vxworks changes
forward port from d7b688870aead912690188b324d370b920a7a600 Task-number: QTBUG-16607 Reviewed-by: Michael Goddard (cherry picked from commit c89c7ebd2600f916eab937cb4853707ab066bc25) Change-Id: I5130fcaaeb162b38c015f8649e83cbf820fb8a44 Reviewed-on: http://codereview.qt.nokia.com/1807 Reviewed-by: Charles Yin <charles.yin@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/sqlite/sqlite3.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/3rdparty/sqlite/sqlite3.c b/src/3rdparty/sqlite/sqlite3.c
index 2c426c21eb..a701737811 100644
--- a/src/3rdparty/sqlite/sqlite3.c
+++ b/src/3rdparty/sqlite/sqlite3.c
@@ -424,7 +424,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
@@ -575,6 +575,13 @@ SQLITE_PRIVATE void sqlite3Coverage(int);
*/
#ifndef _SQLITE3_H_
#define _SQLITE3_H_
+
+#ifdef VXWORKS
+# define SQLITE_HOMEGROWN_RECURSIVE_MUTEX
+# define NO_GETTOD
+# include <ioLib.h>
+#endif
+
#include <stdarg.h> /* Needed for the definition of va_list */
/*
@@ -24379,7 +24386,11 @@ SQLITE_API int sqlite3_os_end(void){
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
-#include <sys/time.h>
+#ifdef VXWORKS
+# include <sys/times.h>
+#else
+# include <sys/time.h>
+#endif
#include <errno.h>
#ifndef SQLITE_OMIT_WAL
#include <sys/mman.h>
@@ -24827,7 +24838,12 @@ static struct unix_syscall {
#define osPread64 ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[10].pCurrent)
{ "write", (sqlite3_syscall_ptr)write, 0 },
-#define osWrite ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)
+
+#ifndef VXWORKS
+ #define osWrite ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent)
+#else
+ #define osWrite ((ssize_t(*)(int,char*,size_t))aSyscall[11].pCurrent)
+#endif
#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE
{ "pwrite", (sqlite3_syscall_ptr)pwrite, 0 },
@@ -25701,6 +25717,11 @@ static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){
return rc;
}
+#ifdef VXWORKS
+static int getpid(){
+ return (int)taskIdCurrent();
+}
+#endif
/*
** Attempt to set a system-lock on the file pFile. The lock is
** described by pLock.
@@ -27507,7 +27528,11 @@ static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){
}
return -1;
}
+#ifndef VXWORKS
do{ got = osWrite(id->h, pBuf, cnt); }while( got<0 && errno==EINTR );
+#else
+ do{ got = osWrite(id->h, (char *)pBuf, cnt); }while( got<0 && errno==EINTR );
+#endif
#endif
TIMER_END;
if( got<0 ){