summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/threads/th-lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/threads/th-lock.c')
-rw-r--r--src/lib/libcrypto/threads/th-lock.c79
1 files changed, 24 insertions, 55 deletions
diff --git a/src/lib/libcrypto/threads/th-lock.c b/src/lib/libcrypto/threads/th-lock.c
index 039022446d..afb4f4caf2 100644
--- a/src/lib/libcrypto/threads/th-lock.c
+++ b/src/lib/libcrypto/threads/th-lock.c
@@ -74,15 +74,14 @@
74#include <ulocks.h> 74#include <ulocks.h>
75#include <sys/prctl.h> 75#include <sys/prctl.h>
76#endif 76#endif
77#include "lhash.h" 77#include <openssl/lhash.h>
78#include "crypto.h" 78#include <openssl/crypto.h>
79#include "buffer.h" 79#include <openssl/buffer.h>
80#include "e_os.h" 80#include <openssl/e_os.h>
81#include "x509.h" 81#include <openssl/x509.h>
82#include "ssl.h" 82#include <openssl/ssl.h>
83#include "err.h" 83#include <openssl/err.h>
84 84
85#ifndef NOPROTO
86int CRYPTO_thread_setup(void); 85int CRYPTO_thread_setup(void);
87void CRYPTO_thread_cleanup(void); 86void CRYPTO_thread_cleanup(void);
88 87
@@ -95,21 +94,6 @@ static unsigned long irix_thread_id(void );
95static unsigned long solaris_thread_id(void ); 94static unsigned long solaris_thread_id(void );
96static unsigned long pthreads_thread_id(void ); 95static unsigned long pthreads_thread_id(void );
97 96
98#else
99int CRYPOTO_thread_setup();
100void CRYPTO_cleanup();
101
102static void irix_locking_callback();
103static void solaris_locking_callback();
104static void win32_locking_callback();
105static void pthreads_locking_callback();
106
107static unsigned long irix_thread_id();
108static unsigned long solaris_thread_id();
109static unsigned long pthreads_thread_id();
110
111#endif
112
113/* usage: 97/* usage:
114 * CRYPTO_thread_setup(); 98 * CRYPTO_thread_setup();
115 * applicaion code 99 * applicaion code
@@ -122,7 +106,7 @@ static unsigned long pthreads_thread_id();
122 106
123static HANDLE lock_cs[CRYPTO_NUM_LOCKS]; 107static HANDLE lock_cs[CRYPTO_NUM_LOCKS];
124 108
125int CRYPTO_thread_setup() 109int CRYPTO_thread_setup(void)
126 { 110 {
127 int i; 111 int i;
128 112
@@ -136,7 +120,7 @@ int CRYPTO_thread_setup()
136 return(1); 120 return(1);
137 } 121 }
138 122
139static void CRYPTO_thread_cleanup() 123static void CRYPTO_thread_cleanup(void)
140 { 124 {
141 int i; 125 int i;
142 126
@@ -145,11 +129,7 @@ static void CRYPTO_thread_cleanup()
145 CloseHandle(lock_cs[i]); 129 CloseHandle(lock_cs[i]);
146 } 130 }
147 131
148void win32_locking_callback(mode,type,file,line) 132void win32_locking_callback(int mode, int type, char *file, int line)
149int mode;
150int type;
151char *file;
152int line;
153 { 133 {
154 if (mode & CRYPTO_LOCK) 134 if (mode & CRYPTO_LOCK)
155 { 135 {
@@ -174,7 +154,7 @@ static long lock_count[CRYPTO_NUM_LOCKS];
174static rwlock_t lock_cs[CRYPTO_NUM_LOCKS]; 154static rwlock_t lock_cs[CRYPTO_NUM_LOCKS];
175#endif 155#endif
176 156
177void CRYPTO_thread_setup() 157void CRYPTO_thread_setup(void)
178 { 158 {
179 int i; 159 int i;
180 160
@@ -192,7 +172,7 @@ void CRYPTO_thread_setup()
192 CRYPTO_set_locking_callback((void (*)())solaris_locking_callback); 172 CRYPTO_set_locking_callback((void (*)())solaris_locking_callback);
193 } 173 }
194 174
195void CRYPTO_thread_cleanup() 175void CRYPTO_thread_cleanup(void)
196 { 176 {
197 int i; 177 int i;
198 178
@@ -207,11 +187,7 @@ void CRYPTO_thread_cleanup()
207 } 187 }
208 } 188 }
209 189
210void solaris_locking_callback(mode,type,file,line) 190void solaris_locking_callback(int mode, int type, char *file, int line)
211int mode;
212int type;
213char *file;
214int line;
215 { 191 {
216#if 0 192#if 0
217 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", 193 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
@@ -248,7 +224,7 @@ int line;
248 } 224 }
249 } 225 }
250 226
251unsigned long solaris_thread_id() 227unsigned long solaris_thread_id(void)
252 { 228 {
253 unsigned long ret; 229 unsigned long ret;
254 230
@@ -263,7 +239,7 @@ unsigned long solaris_thread_id()
263static usptr_t *arena; 239static usptr_t *arena;
264static usema_t *lock_cs[CRYPTO_NUM_LOCKS]; 240static usema_t *lock_cs[CRYPTO_NUM_LOCKS];
265 241
266void CRYPTO_thread_setup() 242void CRYPTO_thread_setup(void)
267 { 243 {
268 int i; 244 int i;
269 char filename[20]; 245 char filename[20];
@@ -287,7 +263,7 @@ void CRYPTO_thread_setup()
287 CRYPTO_set_locking_callback((void (*)())irix_locking_callback); 263 CRYPTO_set_locking_callback((void (*)())irix_locking_callback);
288 } 264 }
289 265
290void CRYPTO_thread_cleanup() 266void CRYPTO_thread_cleanup(void)
291 { 267 {
292 int i; 268 int i;
293 269
@@ -302,11 +278,7 @@ void CRYPTO_thread_cleanup()
302 } 278 }
303 } 279 }
304 280
305void irix_locking_callback(mode,type,file,line) 281void irix_locking_callback(int mode, int type, char *file, int line)
306int mode;
307int type;
308char *file;
309int line;
310 { 282 {
311 if (mode & CRYPTO_LOCK) 283 if (mode & CRYPTO_LOCK)
312 { 284 {
@@ -318,7 +290,7 @@ int line;
318 } 290 }
319 } 291 }
320 292
321unsigned long irix_thread_id() 293unsigned long irix_thread_id(void)
322 { 294 {
323 unsigned long ret; 295 unsigned long ret;
324 296
@@ -333,7 +305,7 @@ unsigned long irix_thread_id()
333static pthread_mutex_t lock_cs[CRYPTO_NUM_LOCKS]; 305static pthread_mutex_t lock_cs[CRYPTO_NUM_LOCKS];
334static long lock_count[CRYPTO_NUM_LOCKS]; 306static long lock_count[CRYPTO_NUM_LOCKS];
335 307
336void CRYPTO_thread_setup() 308void CRYPTO_thread_setup(void)
337 { 309 {
338 int i; 310 int i;
339 311
@@ -347,7 +319,7 @@ void CRYPTO_thread_setup()
347 CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback); 319 CRYPTO_set_locking_callback((void (*)())pthreads_locking_callback);
348 } 320 }
349 321
350void thread_cleanup() 322void thread_cleanup(void)
351 { 323 {
352 int i; 324 int i;
353 325
@@ -358,11 +330,8 @@ void thread_cleanup()
358 } 330 }
359 } 331 }
360 332
361void pthreads_locking_callback(mode,type,file,line) 333void pthreads_locking_callback(int mode, int type, char *file,
362int mode; 334 int line)
363int type;
364char *file;
365int line;
366 { 335 {
367#if 0 336#if 0
368 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", 337 fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
@@ -387,7 +356,7 @@ int line;
387 } 356 }
388 } 357 }
389 358
390unsigned long pthreads_thread_id() 359unsigned long pthreads_thread_id(void)
391 { 360 {
392 unsigned long ret; 361 unsigned long ret;
393 362