summaryrefslogtreecommitdiff
path: root/p11-kit/private.h
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-10-17 14:51:31 +0200
committerStef Walter <stefw@collabora.co.uk>2011-10-17 15:32:41 +0200
commitdb92b76e3acb11e330309ebce071ec2e61400a71 (patch)
treecb11139880974ef8db53dd83a70de8f32d94cc09 /p11-kit/private.h
parentb1d9fd5f88ade222fbd2206c7e11c5514c8b5634 (diff)
downloadp11-kit-db92b76e3acb11e330309ebce071ec2e61400a71.tar.gz
Initial port to win32
* Tests do not all yet pass, at least not on wine * Added abstraction of some non-portable functions in compat.h/c * Build with an argument like this for win32 support: ./autogen.sh --host=i586-mingw32msvc * This win32 port needs more work from interested parties
Diffstat (limited to 'p11-kit/private.h')
-rw-r--r--p11-kit/private.h40
1 files changed, 35 insertions, 5 deletions
diff --git a/p11-kit/private.h b/p11-kit/private.h
index b5a8653..a8f46c5 100644
--- a/p11-kit/private.h
+++ b/p11-kit/private.h
@@ -36,15 +36,45 @@
#define __P11_KIT_PRIVATE_H__
#include "pkcs11.h"
-#include "pthread.h"
+#include "compat.h"
-extern pthread_mutex_t _p11_mutex;
+extern mutex_t _p11_mutex;
-#define _p11_lock() pthread_mutex_lock (&_p11_mutex);
+#define P11_MAX_MESSAGE 512
-#define _p11_unlock() pthread_mutex_unlock (&_p11_mutex);
+typedef struct {
+ char message[P11_MAX_MESSAGE];
+#ifdef OS_WIN32
+ void *last_error;
+#endif
+} p11_local;
-void _p11_message (const char* msg, ...);
+#define _p11_lock() mutex_lock (&_p11_mutex);
+
+#define _p11_unlock() mutex_unlock (&_p11_mutex);
+
+void _p11_message (const char* msg, ...);
+
+p11_local * _p11_library_get_thread_local (void);
+
+#ifdef OS_WIN32
+
+/* No implementation, because done by DllMain */
+#define _p11_library_init_once()
+
+#else /* !OS_WIN32 */
+
+extern pthread_once_t _p11_once;
+
+#define _p11_library_init_once() \
+ pthread_once (&_p11_once, _p11_library_init);
+
+#endif /* !OS_WIN32 */
+
+
+void _p11_library_init (void);
+
+void _p11_library_uninit (void);
CK_FUNCTION_LIST_PTR_PTR _p11_kit_registered_modules_unlocked (void);