openbsd-ports/databases/sqlite3/patches/patch-src_pthread_stub_c

33 lines
1.2 KiB
Plaintext
Raw Normal View History

$OpenBSD: patch-src_pthread_stub_c,v 1.2 2011/01/09 19:11:34 landry Exp $
--- src/pthread_stub.c.orig Tue Nov 23 23:07:52 2010
+++ src/pthread_stub.c Tue Nov 23 23:08:24 2010
@@ -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