From 4d8743f490a5f96fa26d41985ee12cb6b9815a4c Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Fri, 28 Nov 2003 13:10:58 +0000 Subject: Netware-specific changes, PR: 780 Submitted by: Verdon Walker Reviewed by: Richard Levitte --- crypto/threads/mttest.c | 115 +++++++++++++++++++++++++++++++++++++++++++++ crypto/threads/netware.bat | 79 +++++++++++++++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 crypto/threads/netware.bat (limited to 'crypto/threads') diff --git a/crypto/threads/mttest.c b/crypto/threads/mttest.c index 54d598565d..d0e088218b 100644 --- a/crypto/threads/mttest.c +++ b/crypto/threads/mttest.c @@ -77,6 +77,12 @@ #ifdef PTHREADS #include #endif +#ifdef OPENSSL_SYS_NETWARE +#if !defined __int64 +# define __int64 long long +#endif +#include +#endif #include #include #include @@ -86,8 +92,18 @@ #include #include +#ifdef OPENSSL_NO_FP_API +#define APPS_WIN16 +#include "../buffer/bss_file.c" +#endif + +#ifdef OPENSSL_SYS_NETWARE +#define TEST_SERVER_CERT "/openssl/apps/server.pem" +#define TEST_CLIENT_CERT "/openssl/apps/client.pem" +#else #define TEST_SERVER_CERT "../../apps/server.pem" #define TEST_CLIENT_CERT "../../apps/client.pem" +#endif #define MAX_THREAD_NUMBER 100 @@ -100,10 +116,18 @@ void irix_locking_callback(int mode,int type,char *file,int line); void solaris_locking_callback(int mode,int type,char *file,int line); void win32_locking_callback(int mode,int type,char *file,int line); void pthreads_locking_callback(int mode,int type,char *file,int line); +void netware_locking_callback(int mode,int type,char *file,int line); unsigned long irix_thread_id(void ); unsigned long solaris_thread_id(void ); unsigned long pthreads_thread_id(void ); +unsigned long netware_thread_id(void ); + +#if defined(OPENSSL_SYS_NETWARE) +static MPKMutex *lock_cs; +static MPKSema ThreadSem; +static long *lock_count; +#endif BIO *bio_err=NULL; BIO *bio_stdout=NULL; @@ -383,6 +407,9 @@ int ndoit(SSL_CTX *ssl_ctx[2]) SSL_free((SSL *)ctx[2]); SSL_free((SSL *)ctx[3]); } +# ifdef OPENSSL_SYS_NETWARE + MPKSemaphoreSignal(ThreadSem); +# endif return(0); } @@ -626,6 +653,9 @@ int doit(char *ctx[4]) } if ((done & S_DONE) && (done & C_DONE)) break; +# if defined(OPENSSL_SYS_NETWARE) + ThreadSwitchWithDelay(); +# endif } SSL_set_shutdown(c_ssl,SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN); @@ -1093,3 +1123,88 @@ unsigned long pthreads_thread_id(void) +#ifdef OPENSSL_SYS_NETWARE + +void thread_setup(void) +{ + int i; + + lock_cs=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(MPKMutex)); + lock_count=OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long)); + for (i=0; ireferences,c_ctx->references); +} + +unsigned long netware_thread_id(void) +{ + unsigned long ret; + + ret=(unsigned long)GetThreadID(); + return(ret); +} +#endif /* NETWARE */ diff --git a/crypto/threads/netware.bat b/crypto/threads/netware.bat new file mode 100644 index 0000000000..0b3eca3caf --- /dev/null +++ b/crypto/threads/netware.bat @@ -0,0 +1,79 @@ +@echo off +rem batch file to build multi-thread test ( mttest.nlm ) + +rem command line arguments: +rem debug => build using debug settings + +rem +rem After building, copy mttest.nlm to the server and run it, you'll probably +rem want to redirect stdout and stderr. An example command line would be +rem "mttest.nlm -thread 20 -loops 10 -CAfile \openssl\apps\server.pem >mttest.out 2>mttest.err" +rem + +del mttest.nlm + +set BLD_DEBUG= +set CFLAGS= +set LFLAGS= +set LIBS= + +if "%1" == "DEBUG" set BLD_DEBUG=YES +if "%1" == "debug" set BLD_DEBUG=YES + +if "%MWCIncludes%" == "" goto inc_error +if "%PRELUDE%" == "" goto prelude_error +if "%IMPORTS%" == "" goto imports_error + +set CFLAGS=-c -I..\..\outinc_nw -nosyspath -DOPENSSL_SYS_NETWARE -opt off -g -sym internal -maxerrors 20 + +if "%BLD_DEBUG%" == "YES" set LIBS=..\..\out_nw.dbg\ssl.lib ..\..\out_nw.dbg\crypto.lib +if "%BLD_DEBUG%" == "" set LIBS=..\..\out_nw\ssl.lib ..\..\out_nw\crypto.lib + +set LFLAGS=-msgstyle gcc -zerobss -stacksize 32768 -nostdlib -sym internal + +rem generate command file for metrowerks +echo. +echo Generating Metrowerks command file: mttest.def +echo # dynamically generated command file for metrowerks build > mttest.def +echo IMPORT @%IMPORTS%\clib.imp >> mttest.def +echo IMPORT @%IMPORTS%\threads.imp >> mttest.def +echo IMPORT @%IMPORTS%\ws2nlm.imp >> mttest.def +echo IMPORT GetProcessSwitchCount >> mttest.def +echo MODULE clib >> mttest.def + +rem compile +echo. +echo Compiling mttest.c +mwccnlm.exe mttest.c %CFLAGS% +if errorlevel 1 goto end + +rem link +echo. +echo Linking mttest.nlm +mwldnlm.exe %LFLAGS% -screenname mttest -commandfile mttest.def mttest.o "%PRELUDE%" %LIBS% -o mttest.nlm +if errorlevel 1 goto end + +goto end + +:inc_error +echo. +echo Environment variable MWCIncludes is not set - see install.nw +goto end + +:prelude_error +echo. +echo Environment variable PRELUDE is not set - see install.nw +goto end + +:imports_error +echo. +echo Environment variable IMPORTS is not set - see install.nw +goto end + + +:end +set BLD_DEBUG= +set CFLAGS= +set LFLAGS= +set LIBS= + -- cgit v1.2.3