openbsd-ports/databases/sqlite3/patches/patch-src_pthread_stub_c
martynas d55bea2e4b - update to sqlite-3.5.9
- merge espie's patches
- fix apps such as p5-DBD-SQLite, by adding weak pthread functions.
also include some bug fixes from kurt@.  the work has been done by
kurt@, and espie@.  thanks!
ok kurt@, espie@, bernd@
2008-07-23 17:31:17 +00:00

33 lines
1.3 KiB
Plaintext

$OpenBSD: patch-src_pthread_stub_c,v 1.1 2008/07/23 17:31:17 martynas Exp $
--- src/pthread_stub.c.orig Wed Jul 23 10:44:20 2008
+++ src/pthread_stub.c Wed Jul 23 10:47:11 2008
@@ -0,0 +1,28 @@
+/* stubs for pthreads function, quick and dirty */
+#if SQLITE_THREADSAFE && !defined(SQLITE_TEST) && SQLITE_THREAD_OVERRIDE_LOCK == 1
+
+#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