diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/threads/th-lock.c | 79 |
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 | ||
| 86 | int CRYPTO_thread_setup(void); | 85 | int CRYPTO_thread_setup(void); |
| 87 | void CRYPTO_thread_cleanup(void); | 86 | void CRYPTO_thread_cleanup(void); |
| 88 | 87 | ||
| @@ -95,21 +94,6 @@ static unsigned long irix_thread_id(void ); | |||
| 95 | static unsigned long solaris_thread_id(void ); | 94 | static unsigned long solaris_thread_id(void ); |
| 96 | static unsigned long pthreads_thread_id(void ); | 95 | static unsigned long pthreads_thread_id(void ); |
| 97 | 96 | ||
| 98 | #else | ||
| 99 | int CRYPOTO_thread_setup(); | ||
| 100 | void CRYPTO_cleanup(); | ||
| 101 | |||
| 102 | static void irix_locking_callback(); | ||
| 103 | static void solaris_locking_callback(); | ||
| 104 | static void win32_locking_callback(); | ||
| 105 | static void pthreads_locking_callback(); | ||
| 106 | |||
| 107 | static unsigned long irix_thread_id(); | ||
| 108 | static unsigned long solaris_thread_id(); | ||
| 109 | static 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 | ||
| 123 | static HANDLE lock_cs[CRYPTO_NUM_LOCKS]; | 107 | static HANDLE lock_cs[CRYPTO_NUM_LOCKS]; |
| 124 | 108 | ||
| 125 | int CRYPTO_thread_setup() | 109 | int 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 | ||
| 139 | static void CRYPTO_thread_cleanup() | 123 | static 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 | ||
| 148 | void win32_locking_callback(mode,type,file,line) | 132 | void win32_locking_callback(int mode, int type, char *file, int line) |
| 149 | int mode; | ||
| 150 | int type; | ||
| 151 | char *file; | ||
| 152 | int 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]; | |||
| 174 | static rwlock_t lock_cs[CRYPTO_NUM_LOCKS]; | 154 | static rwlock_t lock_cs[CRYPTO_NUM_LOCKS]; |
| 175 | #endif | 155 | #endif |
| 176 | 156 | ||
| 177 | void CRYPTO_thread_setup() | 157 | void 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 | ||
| 195 | void CRYPTO_thread_cleanup() | 175 | void 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 | ||
| 210 | void solaris_locking_callback(mode,type,file,line) | 190 | void solaris_locking_callback(int mode, int type, char *file, int line) |
| 211 | int mode; | ||
| 212 | int type; | ||
| 213 | char *file; | ||
| 214 | int 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 | ||
| 251 | unsigned long solaris_thread_id() | 227 | unsigned 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() | |||
| 263 | static usptr_t *arena; | 239 | static usptr_t *arena; |
| 264 | static usema_t *lock_cs[CRYPTO_NUM_LOCKS]; | 240 | static usema_t *lock_cs[CRYPTO_NUM_LOCKS]; |
| 265 | 241 | ||
| 266 | void CRYPTO_thread_setup() | 242 | void 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 | ||
| 290 | void CRYPTO_thread_cleanup() | 266 | void 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 | ||
| 305 | void irix_locking_callback(mode,type,file,line) | 281 | void irix_locking_callback(int mode, int type, char *file, int line) |
| 306 | int mode; | ||
| 307 | int type; | ||
| 308 | char *file; | ||
| 309 | int 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 | ||
| 321 | unsigned long irix_thread_id() | 293 | unsigned 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() | |||
| 333 | static pthread_mutex_t lock_cs[CRYPTO_NUM_LOCKS]; | 305 | static pthread_mutex_t lock_cs[CRYPTO_NUM_LOCKS]; |
| 334 | static long lock_count[CRYPTO_NUM_LOCKS]; | 306 | static long lock_count[CRYPTO_NUM_LOCKS]; |
| 335 | 307 | ||
| 336 | void CRYPTO_thread_setup() | 308 | void 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 | ||
| 350 | void thread_cleanup() | 322 | void 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 | ||
| 361 | void pthreads_locking_callback(mode,type,file,line) | 333 | void pthreads_locking_callback(int mode, int type, char *file, |
| 362 | int mode; | 334 | int line) |
| 363 | int type; | ||
| 364 | char *file; | ||
| 365 | int 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 | ||
| 390 | unsigned long pthreads_thread_id() | 359 | unsigned long pthreads_thread_id(void) |
| 391 | { | 360 | { |
| 392 | unsigned long ret; | 361 | unsigned long ret; |
| 393 | 362 | ||
