diff options
Diffstat (limited to 'src/lib/libcrypto/threads')
| -rw-r--r-- | src/lib/libcrypto/threads/mttest.c | 99 | ||||
| -rw-r--r-- | src/lib/libcrypto/threads/netware.bat | 79 | ||||
| -rw-r--r-- | src/lib/libcrypto/threads/pthreads-vms.com | 9 |
3 files changed, 81 insertions, 106 deletions
diff --git a/src/lib/libcrypto/threads/mttest.c b/src/lib/libcrypto/threads/mttest.c index eba7aa8a6e..f6f3df4b6a 100644 --- a/src/lib/libcrypto/threads/mttest.c +++ b/src/lib/libcrypto/threads/mttest.c | |||
| @@ -117,13 +117,11 @@ void solaris_locking_callback(int mode,int type,char *file,int line); | |||
| 117 | void win32_locking_callback(int mode,int type,char *file,int line); | 117 | void win32_locking_callback(int mode,int type,char *file,int line); |
| 118 | void pthreads_locking_callback(int mode,int type,char *file,int line); | 118 | void pthreads_locking_callback(int mode,int type,char *file,int line); |
| 119 | void netware_locking_callback(int mode,int type,char *file,int line); | 119 | void netware_locking_callback(int mode,int type,char *file,int line); |
| 120 | void beos_locking_callback(int mode,int type,const char *file,int line); | ||
| 121 | 120 | ||
| 122 | unsigned long irix_thread_id(void ); | 121 | unsigned long irix_thread_id(void ); |
| 123 | unsigned long solaris_thread_id(void ); | 122 | unsigned long solaris_thread_id(void ); |
| 124 | unsigned long pthreads_thread_id(void ); | 123 | unsigned long pthreads_thread_id(void ); |
| 125 | unsigned long netware_thread_id(void ); | 124 | unsigned long netware_thread_id(void ); |
| 126 | unsigned long beos_thread_id(void ); | ||
| 127 | 125 | ||
| 128 | #if defined(OPENSSL_SYS_NETWARE) | 126 | #if defined(OPENSSL_SYS_NETWARE) |
| 129 | static MPKMutex *lock_cs; | 127 | static MPKMutex *lock_cs; |
| @@ -1211,100 +1209,3 @@ unsigned long netware_thread_id(void) | |||
| 1211 | return(ret); | 1209 | return(ret); |
| 1212 | } | 1210 | } |
| 1213 | #endif /* NETWARE */ | 1211 | #endif /* NETWARE */ |
| 1214 | |||
| 1215 | #ifdef BEOS_THREADS | ||
| 1216 | |||
| 1217 | #include <Locker.h> | ||
| 1218 | |||
| 1219 | static BLocker** lock_cs; | ||
| 1220 | static long* lock_count; | ||
| 1221 | |||
| 1222 | void thread_setup(void) | ||
| 1223 | { | ||
| 1224 | int i; | ||
| 1225 | |||
| 1226 | lock_cs=(BLocker**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(BLocker*)); | ||
| 1227 | lock_count=(long*)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); | ||
| 1228 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 1229 | { | ||
| 1230 | lock_count[i]=0; | ||
| 1231 | lock_cs[i] = new BLocker(CRYPTO_get_lock_name(i)); | ||
| 1232 | } | ||
| 1233 | |||
| 1234 | CRYPTO_set_id_callback((unsigned long (*)())beos_thread_id); | ||
| 1235 | CRYPTO_set_locking_callback(beos_locking_callback); | ||
| 1236 | } | ||
| 1237 | |||
| 1238 | void thread_cleanup(void) | ||
| 1239 | { | ||
| 1240 | int i; | ||
| 1241 | |||
| 1242 | CRYPTO_set_locking_callback(NULL); | ||
| 1243 | fprintf(stderr,"cleanup\n"); | ||
| 1244 | for (i=0; i<CRYPTO_num_locks(); i++) | ||
| 1245 | { | ||
| 1246 | delete lock_cs[i]; | ||
| 1247 | fprintf(stderr,"%8ld:%s\n",lock_count[i], | ||
| 1248 | CRYPTO_get_lock_name(i)); | ||
| 1249 | } | ||
| 1250 | OPENSSL_free(lock_cs); | ||
| 1251 | OPENSSL_free(lock_count); | ||
| 1252 | |||
| 1253 | fprintf(stderr,"done cleanup\n"); | ||
| 1254 | } | ||
| 1255 | |||
| 1256 | void beos_locking_callback(int mode, int type, const char *file, int line) | ||
| 1257 | { | ||
| 1258 | #if 0 | ||
| 1259 | fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n", | ||
| 1260 | CRYPTO_thread_id(), | ||
| 1261 | (mode&CRYPTO_LOCK)?"l":"u", | ||
| 1262 | (type&CRYPTO_READ)?"r":"w",file,line); | ||
| 1263 | #endif | ||
| 1264 | if (mode & CRYPTO_LOCK) | ||
| 1265 | { | ||
| 1266 | lock_cs[type]->Lock(); | ||
| 1267 | lock_count[type]++; | ||
| 1268 | } | ||
| 1269 | else | ||
| 1270 | { | ||
| 1271 | lock_cs[type]->Unlock(); | ||
| 1272 | } | ||
| 1273 | } | ||
| 1274 | |||
| 1275 | void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx) | ||
| 1276 | { | ||
| 1277 | SSL_CTX *ssl_ctx[2]; | ||
| 1278 | thread_id thread_ctx[MAX_THREAD_NUMBER]; | ||
| 1279 | int i; | ||
| 1280 | |||
| 1281 | ssl_ctx[0]=s_ctx; | ||
| 1282 | ssl_ctx[1]=c_ctx; | ||
| 1283 | |||
| 1284 | for (i=0; i<thread_number; i++) | ||
| 1285 | { | ||
| 1286 | thread_ctx[i] = spawn_thread((thread_func)ndoit, | ||
| 1287 | NULL, B_NORMAL_PRIORITY, (void *)ssl_ctx); | ||
| 1288 | resume_thread(thread_ctx[i]); | ||
| 1289 | } | ||
| 1290 | |||
| 1291 | printf("waiting...\n"); | ||
| 1292 | for (i=0; i<thread_number; i++) | ||
| 1293 | { | ||
| 1294 | status_t result; | ||
| 1295 | wait_for_thread(thread_ctx[i], &result); | ||
| 1296 | } | ||
| 1297 | |||
| 1298 | printf("beos threads done (%d,%d)\n", | ||
| 1299 | s_ctx->references,c_ctx->references); | ||
| 1300 | } | ||
| 1301 | |||
| 1302 | unsigned long beos_thread_id(void) | ||
| 1303 | { | ||
| 1304 | unsigned long ret; | ||
| 1305 | |||
| 1306 | ret=(unsigned long)find_thread(NULL); | ||
| 1307 | return(ret); | ||
| 1308 | } | ||
| 1309 | |||
| 1310 | #endif /* BEOS_THREADS */ | ||
diff --git a/src/lib/libcrypto/threads/netware.bat b/src/lib/libcrypto/threads/netware.bat new file mode 100644 index 0000000000..0b3eca3caf --- /dev/null +++ b/src/lib/libcrypto/threads/netware.bat | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | @echo off | ||
| 2 | rem batch file to build multi-thread test ( mttest.nlm ) | ||
| 3 | |||
| 4 | rem command line arguments: | ||
| 5 | rem debug => build using debug settings | ||
| 6 | |||
| 7 | rem | ||
| 8 | rem After building, copy mttest.nlm to the server and run it, you'll probably | ||
| 9 | rem want to redirect stdout and stderr. An example command line would be | ||
| 10 | rem "mttest.nlm -thread 20 -loops 10 -CAfile \openssl\apps\server.pem >mttest.out 2>mttest.err" | ||
| 11 | rem | ||
| 12 | |||
| 13 | del mttest.nlm | ||
| 14 | |||
| 15 | set BLD_DEBUG= | ||
| 16 | set CFLAGS= | ||
| 17 | set LFLAGS= | ||
| 18 | set LIBS= | ||
| 19 | |||
| 20 | if "%1" == "DEBUG" set BLD_DEBUG=YES | ||
| 21 | if "%1" == "debug" set BLD_DEBUG=YES | ||
| 22 | |||
| 23 | if "%MWCIncludes%" == "" goto inc_error | ||
| 24 | if "%PRELUDE%" == "" goto prelude_error | ||
| 25 | if "%IMPORTS%" == "" goto imports_error | ||
| 26 | |||
| 27 | set CFLAGS=-c -I..\..\outinc_nw -nosyspath -DOPENSSL_SYS_NETWARE -opt off -g -sym internal -maxerrors 20 | ||
| 28 | |||
| 29 | if "%BLD_DEBUG%" == "YES" set LIBS=..\..\out_nw.dbg\ssl.lib ..\..\out_nw.dbg\crypto.lib | ||
| 30 | if "%BLD_DEBUG%" == "" set LIBS=..\..\out_nw\ssl.lib ..\..\out_nw\crypto.lib | ||
| 31 | |||
| 32 | set LFLAGS=-msgstyle gcc -zerobss -stacksize 32768 -nostdlib -sym internal | ||
| 33 | |||
| 34 | rem generate command file for metrowerks | ||
| 35 | echo. | ||
| 36 | echo Generating Metrowerks command file: mttest.def | ||
| 37 | echo # dynamically generated command file for metrowerks build > mttest.def | ||
| 38 | echo IMPORT @%IMPORTS%\clib.imp >> mttest.def | ||
| 39 | echo IMPORT @%IMPORTS%\threads.imp >> mttest.def | ||
| 40 | echo IMPORT @%IMPORTS%\ws2nlm.imp >> mttest.def | ||
| 41 | echo IMPORT GetProcessSwitchCount >> mttest.def | ||
| 42 | echo MODULE clib >> mttest.def | ||
| 43 | |||
| 44 | rem compile | ||
| 45 | echo. | ||
| 46 | echo Compiling mttest.c | ||
| 47 | mwccnlm.exe mttest.c %CFLAGS% | ||
| 48 | if errorlevel 1 goto end | ||
| 49 | |||
| 50 | rem link | ||
| 51 | echo. | ||
| 52 | echo Linking mttest.nlm | ||
| 53 | mwldnlm.exe %LFLAGS% -screenname mttest -commandfile mttest.def mttest.o "%PRELUDE%" %LIBS% -o mttest.nlm | ||
| 54 | if errorlevel 1 goto end | ||
| 55 | |||
| 56 | goto end | ||
| 57 | |||
| 58 | :inc_error | ||
| 59 | echo. | ||
| 60 | echo Environment variable MWCIncludes is not set - see install.nw | ||
| 61 | goto end | ||
| 62 | |||
| 63 | :prelude_error | ||
| 64 | echo. | ||
| 65 | echo Environment variable PRELUDE is not set - see install.nw | ||
| 66 | goto end | ||
| 67 | |||
| 68 | :imports_error | ||
| 69 | echo. | ||
| 70 | echo Environment variable IMPORTS is not set - see install.nw | ||
| 71 | goto end | ||
| 72 | |||
| 73 | |||
| 74 | :end | ||
| 75 | set BLD_DEBUG= | ||
| 76 | set CFLAGS= | ||
| 77 | set LFLAGS= | ||
| 78 | set LIBS= | ||
| 79 | |||
diff --git a/src/lib/libcrypto/threads/pthreads-vms.com b/src/lib/libcrypto/threads/pthreads-vms.com index 1cf92bdf57..63f5b8cc2e 100644 --- a/src/lib/libcrypto/threads/pthreads-vms.com +++ b/src/lib/libcrypto/threads/pthreads-vms.com | |||
| @@ -2,13 +2,8 @@ $! To compile mttest on VMS. | |||
| 2 | $! | 2 | $! |
| 3 | $! WARNING: only tested with DEC C so far. | 3 | $! WARNING: only tested with DEC C so far. |
| 4 | $ | 4 | $ |
| 5 | $ if (f$getsyi("cpu").lt.128) | 5 | $ arch := vax |
| 6 | $ then | 6 | $ if f$getsyi("CPU") .ge. 128 then arch := axp |
| 7 | $ arch := VAX | ||
| 8 | $ else | ||
| 9 | $ arch = f$edit( f$getsyi( "ARCH_NAME"), "UPCASE") | ||
| 10 | $ if (arch .eqs. "") then arch = "UNK" | ||
| 11 | $ endif | ||
| 12 | $ define/user openssl [--.include.openssl] | 7 | $ define/user openssl [--.include.openssl] |
| 13 | $ cc/def=PTHREADS mttest.c | 8 | $ cc/def=PTHREADS mttest.c |
| 14 | $ link mttest,[--.'arch'.exe.ssl]libssl/lib,[--.'arch'.exe.crypto]libcrypto/lib | 9 | $ link mttest,[--.'arch'.exe.ssl]libssl/lib,[--.'arch'.exe.crypto]libcrypto/lib |
