0
|
1 |
--- sqlite3.c.orig
|
|
2 |
+++ sqlite3.c
|
|
3 |
@@ -383,7 +383,7 @@ SQLITE_PRIVATE void sqlite3Coverage(int);
|
|
4 |
**
|
|
5 |
** See also ticket #2741.
|
|
6 |
*/
|
|
7 |
-#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE
|
|
8 |
+#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE && !defined(VXWORKS)
|
|
9 |
# define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */
|
|
10 |
#endif
|
|
11 |
|
|
12 |
@@ -440,6 +440,13 @@ SQLITE_PRIVATE void sqlite3Coverage(int);
|
|
13 |
*/
|
|
14 |
#ifndef _SQLITE3_H_
|
|
15 |
#define _SQLITE3_H_
|
|
16 |
+
|
|
17 |
+#ifdef VXWORKS
|
|
18 |
+# define SQLITE_HOMEGROWN_RECURSIVE_MUTEX
|
|
19 |
+# define NO_GETTOD
|
|
20 |
+# include <ioLib.h>
|
|
21 |
+#endif
|
|
22 |
+
|
|
23 |
#include <stdarg.h> /* Needed for the definition of va_list */
|
|
24 |
|
|
25 |
/*
|
|
26 |
@@ -18792,7 +18799,11 @@ SQLITE_PRIVATE sqlite3_vfs *sqlite3OsDefaultVfs(void){
|
|
27 |
#include <sys/stat.h>
|
|
28 |
#include <fcntl.h>
|
|
29 |
#include <unistd.h>
|
|
30 |
-#include <sys/time.h>
|
|
31 |
+#ifdef VXWORKS
|
|
32 |
+# include <sys/times.h>
|
|
33 |
+#else
|
|
34 |
+# include <sys/time.h>
|
|
35 |
+#endif
|
|
36 |
#include <errno.h>
|
|
37 |
#ifdef SQLITE_ENABLE_LOCKING_STYLE
|
|
38 |
#include <sys/ioctl.h>
|
|
39 |
@@ -19728,7 +19739,11 @@ static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){
|
|
40 |
if( newOffset!=offset ){
|
|
41 |
return -1;
|
|
42 |
}
|
|
43 |
+# ifndef VXWORKS
|
|
44 |
got = write(id->h, pBuf, cnt);
|
|
45 |
+# else
|
|
46 |
+ got = write(id->h, (char *)pBuf, cnt);
|
|
47 |
+# endif
|
|
48 |
#endif
|
|
49 |
TIMER_END;
|
|
50 |
OSTRACE5("WRITE %-3d %5d %7lld %d\n", id->h, got, offset, TIMER_ELAPSED);
|
|
51 |
@@ -21554,12 +21569,16 @@ static int unixRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
|
|
52 |
#if !defined(SQLITE_TEST)
|
|
53 |
{
|
|
54 |
int pid, fd;
|
|
55 |
- fd = open("/dev/urandom", O_RDONLY);
|
|
56 |
+ fd = open("/dev/urandom", O_RDONLY, 0);
|
|
57 |
if( fd<0 ){
|
|
58 |
time_t t;
|
|
59 |
time(&t);
|
|
60 |
memcpy(zBuf, &t, sizeof(t));
|
|
61 |
+#ifndef VXWORKS
|
|
62 |
pid = getpid();
|
|
63 |
+#else
|
|
64 |
+ pid = (int)taskIdCurrent();
|
|
65 |
+#endif
|
|
66 |
memcpy(&zBuf[sizeof(t)], &pid, sizeof(pid));
|
|
67 |
}else{
|
|
68 |
read(fd, zBuf, nBuf);
|