summaryrefslogtreecommitdiffstats
path: root/lib/libsqlite3/tsrc/pthread_stub.c
diff options
context:
space:
mode:
authorespie <espie@openbsd.org>2012-04-14 13:18:17 +0000
committerespie <espie@openbsd.org>2012-04-14 13:18:17 +0000
commit25fb62ebb72c664e5f64544ff3834af3c279bb9f (patch)
tree447f24d0f39780b4b3ebc30cbb0dad4bd8cc482a /lib/libsqlite3/tsrc/pthread_stub.c
parentsqlite 3.7.11 library, vendor sources (diff)
downloadwireguard-openbsd-25fb62ebb72c664e5f64544ff3834af3c279bb9f.tar.xz
wireguard-openbsd-25fb62ebb72c664e5f64544ff3834af3c279bb9f.zip
extra src for us.
regen parse.c/parse.h with "lemon", no need to recompile every time. pthread_stub.c might(?) be needed for clean non-pthreads operation (to be checked, the nomutex stuff looks interesting)
Diffstat (limited to 'lib/libsqlite3/tsrc/pthread_stub.c')
-rw-r--r--lib/libsqlite3/tsrc/pthread_stub.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/libsqlite3/tsrc/pthread_stub.c b/lib/libsqlite3/tsrc/pthread_stub.c
new file mode 100644
index 00000000000..995c9ca36e2
--- /dev/null
+++ b/lib/libsqlite3/tsrc/pthread_stub.c
@@ -0,0 +1,28 @@
+/* stubs for pthreads function, quick and dirty */
+#if SQLITE_THREADSAFE && !defined(SQLITE_TEST)
+
+#include <pthread.h>
+
+#define WEAKALIAS(f,g ) extern f __attribute__((__weak__, __alias__(#g)))
+
+static pthread_t _sqlite_self_stub()
+{
+ return 0;
+}
+
+static int _sqlite_zero_stub()
+{
+ return 0;
+}
+
+WEAKALIAS(pthread_t pthread_self(void), _sqlite_self_stub);
+WEAKALIAS(int pthread_mutex_init(pthread_mutex_t *a, const pthread_mutexattr_t *b), _sqlite_zero_stub);
+WEAKALIAS(int pthread_mutex_destroy(pthread_mutex_t *a), _sqlite_zero_stub);
+WEAKALIAS(int pthread_mutex_lock(pthread_mutex_t *a), _sqlite_zero_stub);
+WEAKALIAS(int pthread_mutex_trylock(pthread_mutex_t *a), _sqlite_zero_stub);
+WEAKALIAS(int pthread_mutex_unlock(pthread_mutex_t *a), _sqlite_zero_stub);
+WEAKALIAS(int pthread_mutexattr_init(pthread_mutexattr_t *a), _sqlite_zero_stub);
+WEAKALIAS(int pthread_mutexattr_settype(pthread_mutexattr_t *a, int b), _sqlite_zero_stub);
+WEAKALIAS(int pthread_mutexattr_destroy(pthread_mutexattr_t *a), _sqlite_zero_stub);
+
+#endif