Add BeOS support.
authorUlf Möller <ulf@openssl.org>
Tue, 11 Apr 2006 21:34:21 +0000 (21:34 +0000)
committerUlf Möller <ulf@openssl.org>
Tue, 11 Apr 2006 21:34:21 +0000 (21:34 +0000)
PR: 1312
Submitted by: Oliver Tappe <zooey@hirschkaefer.de>
Reviewed by: Ulf Moeller

20 files changed:
CHANGES
Configure
Makefile.shared
apps/s_client.c
apps/s_server.c
config
crypto/bio/b_sock.c
crypto/bio/bss_dgram.c
crypto/cryptlib.c
crypto/dso/Makefile
crypto/dso/dso.h
crypto/dso/dso_err.c
crypto/dso/dso_openssl.c
crypto/rand/rand_egd.c
crypto/rand/rand_unix.c
crypto/threads/mttest.c
crypto/ui/ui_openssl.c
e_os.h
e_os2.h
engines/Makefile

diff --git a/CHANGES b/CHANGES
index 472b83a..3ff6927 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,13 @@
 
  Changes between 0.9.8a and 0.9.9  [xx XXX xxxx]
 
+  *) BeOS support.
+     [Oliver Tappe <zooey@hirschkaefer.de>]
+
+  *) New make target "install_html_docs" installs HTML renditions of the
+     manual pages.
+     [Oliver Tappe <zooey@hirschkaefer.de>]
+
   *) New utility "genpkey" this is analagous to "genrsa" etc except it can
      generate keys for any algorithm. Extend and update EVP_PKEY_METHOD to
      support key and parameter generation and add initial key generation
index e4124c4..04439a2 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -381,6 +381,10 @@ my %table=(
 "qnx4",        "cc:-DL_ENDIAN -DTERMIO::(unknown):::${x86_gcc_des} ${x86_gcc_opts}:",
 "qnx6",        "cc:-DL_ENDIAN -DTERMIOS::(unknown)::-lsocket:${x86_gcc_des} ${x86_gcc_opts}:",
 
+# BeOS
+"beos-x86-r5",   "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so",
+"beos-x86-bone", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lbind -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC:-shared:.so",
+
 #### SCO/Caldera targets.
 #
 # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
index ef1bfe1..b44c7ea 100644 (file)
@@ -170,6 +170,17 @@ link_a.gnu:
 link_app.gnu:
        @ $(DO_GNU_APP); $(LINK_APP)
 
+DO_BEOS_SO=    SHLIB=lib$(LIBNAME).so; \
+       SHLIB_SUFFIX=; \
+       ALLSYMSFLAGS='-Wl,--whole-archive'; \
+       NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
+       SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname=$$SHLIB$$SHLIB_SUFFIX"
+
+link_o.beos:
+       @ $(DO_BEOS_SO); $(LINK_SO_O)
+link_a.beos:
+       @ $(DO_BEOS_SO); $(LINK_SO_A)
+
 link_o.bsd:
        @if ${DETECT_GNU_LD}; then $(DO_GNU_SO); else \
        $(CALC_VERSIONS); \
@@ -543,7 +554,7 @@ symlink.hpux:
        expr $(PLATFORM) : '.*ia64' > /dev/null && SHLIB=lib$(LIBNAME).so; \
        $(SYMLINK_SO)
 # The following lines means those specific architectures do no symlinks
-symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath:
+symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath symlink.beos:
 
 # Compatibility targets
 link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
@@ -601,3 +612,7 @@ link_o.reliantunix-shared: link_o.reliantunix
 link_a.reliantunix-shared: link_a.reliantunix
 link_app.reliantunix-shared: link_app.reliantunix
 symlink.reliantunix-shared: symlink.reliantunix
+link_o.beos-shared: link_o.beos
+link_a.beos-shared: link_a.beos
+link_app.beos-shared: link_app.gnu
+symlink.beos-shared: symlink.beos
index 251da63..93e640c 100644 (file)
@@ -169,6 +169,10 @@ typedef unsigned int u_int;
 #undef FIONBIO
 #endif
 
+#if defined(OPENSSL_SYS_BEOS_R5)
+#include <fcntl.h>
+#endif
+
 #undef PROG
 #define PROG   s_client_main
 
@@ -379,8 +383,11 @@ int MAIN(int argc, char **argv)
        char *engine_id=NULL;
        ENGINE *e=NULL;
 #endif
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE)
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
        struct timeval tv;
+#if defined(OPENSSL_SYS_BEOS_R5)
+       int stdin_set = 0;
+#endif
 #endif
 
 #ifndef OPENSSL_NO_TLSEXT
@@ -949,7 +956,7 @@ re_start:
 
                if (!ssl_pending)
                        {
-#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE)
+#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined (OPENSSL_SYS_BEOS_R5)
                        if (tty_on)
                                {
                                if (read_tty)  FD_SET(fileno(stdin),&readfds);
@@ -1009,6 +1016,25 @@ re_start:
                                } else  i=select(width,(void *)&readfds,(void *)&writefds,
                                        NULL,NULL);
                        }
+#elif defined(OPENSSL_SYS_BEOS_R5)
+                       /* Under BeOS-R5 the situation is similar to DOS */
+                       i=0;
+                       stdin_set = 0;
+                       (void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
+                       if(!write_tty) {
+                               if(read_tty) {
+                                       tv.tv_sec = 1;
+                                       tv.tv_usec = 0;
+                                       i=select(width,(void *)&readfds,(void *)&writefds,
+                                                NULL,&tv);
+                                       if (read(fileno(stdin), sbuf, 0) >= 0)
+                                               stdin_set = 1;
+                                       if (!i && (stdin_set != 1 || !read_tty))
+                                               continue;
+                               } else  i=select(width,(void *)&readfds,(void *)&writefds,
+                                        NULL,NULL);
+                       }
+                       (void)fcntl(fileno(stdin), F_SETFL, 0);
 #else
                        i=select(width,(void *)&readfds,(void *)&writefds,
                                 NULL,NULL);
@@ -1089,8 +1115,8 @@ re_start:
                                goto shut;
                                }
                        }
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE)
-               /* Assume Windows/DOS can always write */
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
+               /* Assume Windows/DOS/BeOS can always write */
                else if (!ssl_pending && write_tty)
 #else
                else if (!ssl_pending && FD_ISSET(fileno(stdout),&writefds))
@@ -1178,6 +1204,8 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
 #endif
 #elif defined (OPENSSL_SYS_NETWARE)
                else if (_kbhit())
+#elif defined(OPENSSL_SYS_BEOS_R5)
+               else if (stdin_set)
 #else
                else if (FD_ISSET(fileno(stdin),&readfds))
 #endif
index 9982d6a..69a2f6c 100644 (file)
@@ -193,6 +193,10 @@ typedef unsigned int u_int;
 #undef FIONBIO
 #endif
 
+#if defined(OPENSSL_SYS_BEOS_R5)
+#include <fcntl.h>
+#endif
+
 #ifndef OPENSSL_NO_RSA
 static RSA MS_CALLBACK *tmp_rsa_cb(SSL *s, int is_export, int keylength);
 #endif
@@ -1511,7 +1515,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
        unsigned long l;
        SSL *con=NULL;
        BIO *sbio;
-#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE)
+#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS_R5)
        struct timeval tv;
 #endif
 
@@ -1616,7 +1620,7 @@ static int sv_body(char *hostname, int s, unsigned char *context)
                if (!read_from_sslcon)
                        {
                        FD_ZERO(&readfds);
-#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE)
+#if !defined(OPENSSL_SYS_WINDOWS) && !defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_NETWARE) && !defined(OPENSSL_SYS_BEOS_R5)
                        FD_SET(fileno(stdin),&readfds);
 #endif
                        FD_SET(s,&readfds);
@@ -1638,6 +1642,17 @@ static int sv_body(char *hostname, int s, unsigned char *context)
                        if((i < 0) || (!i && !_kbhit() ) )continue;
                        if(_kbhit())
                                read_from_terminal = 1;
+#elif defined(OPENSSL_SYS_BEOS_R5)
+                       /* Under BeOS-R5 the situation is similar to DOS */
+                       tv.tv_sec = 1;
+                       tv.tv_usec = 0;
+                       (void)fcntl(fileno(stdin), F_SETFL, O_NONBLOCK);
+                       i=select(width,(void *)&readfds,NULL,NULL,&tv);
+                       if ((i < 0) || (!i && read(fileno(stdin), buf, 0) < 0))
+                               continue;
+                       if (read(fileno(stdin), buf, 0) >= 0)
+                               read_from_terminal = 1;
+                       (void)fcntl(fileno(stdin), F_SETFL, 0);
 #else
                        i=select(width,(void *)&readfds,NULL,NULL,NULL);
                        if (i <= 0) continue;
diff --git a/config b/config
index 6583959..3897473 100755 (executable)
--- a/config
+++ b/config
@@ -122,6 +122,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
        echo "${MACHINE}-ibm-aix3"; exit 0
        ;;
 
+    BeOS:*:BePC)
+    if [ -e /boot/develop/headers/be/bone ]; then
+               echo "beos-x86-bone"; exit 0
+       else
+               echo "beos-x86-r5"; exit 0
+       fi
+       ;;
+
     dgux:*)
        echo "${MACHINE}-dg-dgux"; exit 0
        ;;
@@ -759,6 +767,7 @@ case "$GUESSOS" in
   t3e-cray-unicosmk) OUT="cray-t3e" ;;
   j90-cray-unicos) OUT="cray-j90" ;;
   nsr-tandem-nsk) OUT="tandem-c89" ;;
+  beos-*) OUT="$GUESSOS" ;;
   *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
 esac
 
index 710a8d6..c8ca592 100644 (file)
 static int wsa_init_done=0;
 #endif
 
+#if defined(OPENSSL_SYS_BEOS_BONE)             
+/* BONE's IP6 support is incomplete */
+#undef AF_INET6
+#endif
+
 #if 0
 static unsigned long BIO_ghbn_hits=0L;
 static unsigned long BIO_ghbn_miss=0L;
@@ -220,6 +225,10 @@ int BIO_sock_error(int sock)
        int j,i;
        int size;
                 
+#if defined(OPENSSL_SYS_BEOS_R5)
+       return 0;
+#endif
+                
        size=sizeof(int);
        /* Note: under Windows the third parameter is of type (char *)
         * whereas under other systems it is (void *) if you don't have
@@ -799,7 +808,7 @@ int BIO_accept(int sock, char **addr)
        if (addr == NULL) goto end;
 
 #ifdef EAI_FAMILY
-# ifdef OPENSSL_SYS_VMS
+# if defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_BEOS_BONE)
 #  define SOCKLEN_T size_t
 # else
 #  define SOCKLEN_T socklen_t
index c21a81d..771003e 100644 (file)
@@ -341,6 +341,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
 
         memcpy(&(data->peer), to, sizeof(struct sockaddr));
         break;
+#if defined(SO_RCVTIMEO)
        case BIO_CTRL_DGRAM_SET_RECV_TIMEOUT:
                if ( setsockopt(b->num, SOL_SOCKET, SO_RCVTIMEO, ptr,
                        sizeof(struct timeval)) < 0)
@@ -351,6 +352,8 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
                        ptr, (void *)&ret) < 0)
                        { perror("getsockopt"); ret = -1; }
                break;
+#endif
+#if defined(SO_SNDTIMEO)
        case BIO_CTRL_DGRAM_SET_SEND_TIMEOUT:
                if ( setsockopt(b->num, SOL_SOCKET, SO_SNDTIMEO, ptr,
                        sizeof(struct timeval)) < 0)
@@ -361,6 +364,7 @@ static long dgram_ctrl(BIO *b, int cmd, long num, void *ptr)
                        ptr, (void *)&ret) < 0)
                        { perror("getsockopt"); ret = -1; }
                break;
+#endif
        case BIO_CTRL_DGRAM_GET_SEND_TIMER_EXP:
                /* fall-through */
        case BIO_CTRL_DGRAM_GET_RECV_TIMER_EXP:
index 6464c53..aa19dd7 100644 (file)
@@ -436,6 +436,8 @@ unsigned long CRYPTO_thread_id(void)
                ret=(unsigned long)GetCurrentThreadId();
 #elif defined(GETPID_IS_MEANINGLESS)
                ret=1L;
+#elif defined(OPENSSL_SYS_BEOS)
+               ret=(unsigned long)find_thread(NULL);
 #else
                ret=(unsigned long)getpid();
 #endif
index 07f5d8d..105d1e0 100644 (file)
@@ -18,9 +18,9 @@ APPS=
 
 LIB=$(TOP)/libcrypto.a
 LIBSRC= dso_dl.c dso_dlfcn.c dso_err.c dso_lib.c dso_null.c \
-       dso_openssl.c dso_win32.c dso_vms.c
+       dso_openssl.c dso_win32.c dso_vms.c dso_beos.c
 LIBOBJ= dso_dl.o dso_dlfcn.o dso_err.o dso_lib.o dso_null.o \
-       dso_openssl.o dso_win32.o dso_vms.o
+       dso_openssl.o dso_win32.o dso_vms.o dso_beos.o
 
 SRC= $(LIBSRC)
 
index 8934c4e..3aa4f7a 100644 (file)
@@ -322,6 +322,9 @@ int DSO_pathbyaddr(void *addr,char *path,int sz);
  * itself or libsocket. */
 void *DSO_global_lookup(const char *name);
 
+/* If BeOS is defined, use shared images. If not, return NULL. */
+DSO_METHOD *DSO_METHOD_beos(void);
+
 /* BEGIN ERROR CODES */
 /* The following lines are auto generated by the script mkerr.pl. Any changes
  * made after this point may be overwritten when the script is next run.
@@ -331,6 +334,11 @@ void ERR_load_DSO_strings(void);
 /* Error codes for the DSO functions. */
 
 /* Function codes. */
+#define DSO_F_BEOS_BIND_FUNC                            130
+#define DSO_F_BEOS_BIND_VAR                             131
+#define DSO_F_BEOS_LOAD                                         132
+#define DSO_F_BEOS_NAME_CONVERTER                       133
+#define DSO_F_BEOS_UNLOAD                               134
 #define DSO_F_DLFCN_BIND_FUNC                           100
 #define DSO_F_DLFCN_BIND_VAR                            101
 #define DSO_F_DLFCN_LOAD                                102
index 009a543..d7c6087 100644 (file)
 
 static ERR_STRING_DATA DSO_str_functs[]=
        {
+{ERR_FUNC(DSO_F_BEOS_BIND_FUNC),       "BEOS_BIND_FUNC"},
+{ERR_FUNC(DSO_F_BEOS_BIND_VAR),        "BEOS_BIND_VAR"},
+{ERR_FUNC(DSO_F_BEOS_LOAD),    "BEOS_LOAD"},
+{ERR_FUNC(DSO_F_BEOS_NAME_CONVERTER),  "BEOS_NAME_CONVERTER"},
+{ERR_FUNC(DSO_F_BEOS_UNLOAD),  "BEOS_UNLOAD"},
 {ERR_FUNC(DSO_F_DLFCN_BIND_FUNC),      "DLFCN_BIND_FUNC"},
 {ERR_FUNC(DSO_F_DLFCN_BIND_VAR),       "DLFCN_BIND_VAR"},
 {ERR_FUNC(DSO_F_DLFCN_LOAD),   "DLFCN_LOAD"},
index a4395eb..b17e8e8 100644 (file)
@@ -74,6 +74,8 @@ DSO_METHOD *DSO_METHOD_openssl(void)
        return(DSO_METHOD_win32());
 #elif defined(DSO_VMS)
        return(DSO_METHOD_vms());
+#elif defined(DSO_BEOS)
+       return(DSO_METHOD_beos());
 #else
        return(DSO_METHOD_null());
 #endif
index 50bce6c..d53b916 100644 (file)
@@ -95,7 +95,7 @@
  *   RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
  */
 
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS)
+#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_BEOS)
 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
        {
        return(-1);
index c340642..c4838b6 100644 (file)
@@ -205,6 +205,16 @@ int RAND_poll(void)
 
                        do
                                {
+#if defined(OPENSSL_SYS_BEOS_R5)
+                               /* select() is broken in BeOS R5, so we simply 
+                                *  try to read something and snooze if we couldn't: */
+                               r=read(fd,(unsigned char *)tmpbuf+n,
+                                      ENTROPY_NEEDED-n);
+                               if (r > 0)
+                                       n += r;
+                               else if (r == 0)
+                                       snooze(t.tv_usec);
+#else
                                FD_ZERO(&fset);
                                FD_SET(fd, &fset);
                                r = -1;
@@ -218,7 +228,7 @@ int RAND_poll(void)
                                        if (r > 0)
                                                n += r;
                                        }
-
+#endif
                                /* Some Unixen will update t, some
                                   won't.  For those who won't, give
                                   up here, otherwise, we will do
@@ -267,6 +277,14 @@ int RAND_poll(void)
        l=time(NULL);
        RAND_add(&l,sizeof(l),0.0);
 
+#if defined(OPENSSL_SYS_BEOS)
+       {
+       system_info sysInfo;
+       get_system_info(&sysInfo);
+       RAND_add(&sysInfo,sizeof(sysInfo),0);
+       }
+#endif
+
 #if defined(DEVRANDOM) || defined(DEVRANDOM_EGD)
        return 1;
 #else
index f6f3df4..eba7aa8 100644 (file)
@@ -117,11 +117,13 @@ 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);
+void beos_locking_callback(int mode,int type,const 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 );
+unsigned long beos_thread_id(void );
 
 #if defined(OPENSSL_SYS_NETWARE)
 static MPKMutex *lock_cs;
@@ -1209,3 +1211,100 @@ unsigned long netware_thread_id(void)
    return(ret);
 }
 #endif /* NETWARE */
+
+#ifdef BEOS_THREADS
+
+#include <Locker.h>
+
+static BLocker** lock_cs;
+static long* lock_count;
+
+void thread_setup(void)
+       {
+       int i;
+
+       lock_cs=(BLocker**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(BLocker*));
+       lock_count=(long*)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(long));
+       for (i=0; i<CRYPTO_num_locks(); i++)
+               {
+               lock_count[i]=0;
+               lock_cs[i] = new BLocker(CRYPTO_get_lock_name(i));
+               }
+
+       CRYPTO_set_id_callback((unsigned long (*)())beos_thread_id);
+       CRYPTO_set_locking_callback(beos_locking_callback);
+       }
+
+void thread_cleanup(void)
+       {
+       int i;
+
+       CRYPTO_set_locking_callback(NULL);
+       fprintf(stderr,"cleanup\n");
+       for (i=0; i<CRYPTO_num_locks(); i++)
+               {
+               delete lock_cs[i];
+               fprintf(stderr,"%8ld:%s\n",lock_count[i],
+                       CRYPTO_get_lock_name(i));
+               }
+       OPENSSL_free(lock_cs);
+       OPENSSL_free(lock_count);
+
+       fprintf(stderr,"done cleanup\n");
+       }
+
+void beos_locking_callback(int mode, int type, const char *file, int line)
+    {
+#if 0
+       fprintf(stderr,"thread=%4d mode=%s lock=%s %s:%d\n",
+               CRYPTO_thread_id(),
+               (mode&CRYPTO_LOCK)?"l":"u",
+               (type&CRYPTO_READ)?"r":"w",file,line);
+#endif
+       if (mode & CRYPTO_LOCK)
+               {
+               lock_cs[type]->Lock();
+               lock_count[type]++;
+               }
+       else
+               {
+               lock_cs[type]->Unlock();
+               }
+       }
+
+void do_threads(SSL_CTX *s_ctx, SSL_CTX *c_ctx)
+       {
+       SSL_CTX *ssl_ctx[2];
+       thread_id thread_ctx[MAX_THREAD_NUMBER];
+       int i;
+
+       ssl_ctx[0]=s_ctx;
+       ssl_ctx[1]=c_ctx;
+
+       for (i=0; i<thread_number; i++)
+               {
+               thread_ctx[i] = spawn_thread((thread_func)ndoit,
+                       NULL, B_NORMAL_PRIORITY, (void *)ssl_ctx);
+               resume_thread(thread_ctx[i]);
+               }
+
+       printf("waiting...\n");
+       for (i=0; i<thread_number; i++)
+               {
+               status_t result;
+               wait_for_thread(thread_ctx[i], &result);
+               }
+
+       printf("beos threads done (%d,%d)\n",
+               s_ctx->references,c_ctx->references);
+       }
+
+unsigned long beos_thread_id(void)
+       {
+       unsigned long ret;
+
+       ret=(unsigned long)find_thread(NULL);
+       return(ret);
+       }
+
+#endif /* BEOS_THREADS */
index 1f23a45..8eabb85 100644 (file)
@@ -473,7 +473,7 @@ static int open_console(UI *ui)
        CRYPTO_w_lock(CRYPTO_LOCK_UI);
        is_a_tty = 1;
 
-#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE)
+#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_BEOS)
        tty_in=stdin;
        tty_out=stderr;
 #else
diff --git a/e_os.h b/e_os.h
index 78753de..b8a7e35 100644 (file)
--- a/e_os.h
+++ b/e_os.h
@@ -178,6 +178,13 @@ extern "C" {
 #define closesocket(s)             close(s)
 #define readsocket(s,b,n)          read((s),(b),(n))
 #define writesocket(s,b,n)         write((s),(char *)(b),(n))
+#elif defined(OPENSSL_SYS_BEOS_R5)
+#define get_last_socket_error() errno
+#define clear_socket_error()    errno=0
+#define FIONBIO SO_NONBLOCK
+#define ioctlsocket(a,b,c)               setsockopt((a),SOL_SOCKET,(b),(c),sizeof(*(c)))
+#define readsocket(s,b,n)       recv((s),(b),(n),0)
+#define writesocket(s,b,n)      send((s),(b),(n),0)
 #elif defined(OPENSSL_SYS_NETWARE)
 #if defined(NETWARE_BSDSOCK)
 #define get_last_socket_error() errno
@@ -519,8 +526,10 @@ static unsigned int _strlen31(const char *str)
 #        include <sys/filio.h> /* Added for FIONBIO under unixware */
 #      endif
 #      include <netinet/in.h>
+#      if !defined(OPENSSL_SYS_BEOS_R5)
 #      include <arpa/inet.h>
 #    endif
+#    endif
 
 #    if defined(NeXT) || defined(_NEXT_SOURCE)
 #      include <sys/fcntl.h>
@@ -661,6 +670,15 @@ struct servent *getservbyname(const char *name, const char *proto);
 #endif
 /* end vxworks */
 
+/* beos */
+#if defined(OPENSSL_SYS_BEOS_R5)
+#define SO_ERROR 0
+#define NO_SYS_UN
+#define IPPROTO_IP 0
+#include <OS.h>
+#endif
+
+
 #ifdef  __cplusplus
 }
 #endif
diff --git a/e_os2.h b/e_os2.h
index 9da0b65..3f72b06 100644 (file)
--- a/e_os2.h
+++ b/e_os2.h
@@ -202,6 +202,17 @@ extern "C" {
 # define OPENSSL_SYS_VXWORKS
 #endif
 
+/* --------------------------------- BeOS ---------------------------------- */
+#if defined(__BEOS__)
+# define OPENSSL_SYS_BEOS
+# include <sys/socket.h>
+# if defined(BONE_VERSION)
+#  define OPENSSL_SYS_BEOS_BONE
+# else
+#  define OPENSSL_SYS_BEOS_R5
+# endif
+#endif
+
 /**
  * That's it for OS-specific stuff
  *****************************************************************************/
index 88f8390..4f1b458 100644 (file)
@@ -93,6 +93,7 @@ install:
                        ( echo installing $$l; \
                          if [ "$(PLATFORM)" != "Cygwin" ]; then \
                                case "$(CFLAGS)" in \
+                               *DSO_BEOS*)     sfx="so";;      \
                                *DSO_DLFCN*)    sfx="so";;      \
                                *DSO_DL*)       sfx="sl";;      \
                                *)              sfx="bad";;     \