rw26> I'm using openssl-0.9.4 on solirs 2.6 on a Sun E3500 (sparc) [...] Noted. rw26> Anyway, when I run my app, I call n = SSL_read( ssl, (char *)&ch, 1 ); rw26> to retrieve a byte into an int named ch. I find that my correct rw26> byte is returned in the most significant byte of the int. No surprise there. A sparc is a big-endian architecture, meaning the first byte of an int (address-wise) is the most significant byte. rw26> This seems to indicate that I have some sort of an alignment rw26> issue. No. rw26> I could use help solving this problem. Make ch a char instead of an int. rw26> The other problem is with my multithreading. I'm opening a thread rw26> for each new accepted socket. When I do this I I call SSL_new, set rw26> the fd to my newly accepted connection and call SSL_accept. rw26> Here's the code from my server: rw26> rw26> pthread_mutex_lock( &mallfree_mutex ); rw26> myev->ssl = SSL_new (ctx); rw26> CHK_NULL( myev->ssl ); rw26> SSL_set_fd (myev->ssl, myev->fd); rw26> err = SSL_accept (myev->ssl); rw26> if( err == -1 ) { rw26> close( myev->fd ); rw26> SSL_free(myev->ssl); rw26> free( myev ); rw26> pthread_mutex_unlock( &mallfree_mutex ); rw26> continue; rw26> } rw26> pthread_mutex_unlock( &mallfree_mutex ); rw26> rw26> rw26> When I open more than three simultaneous threads, my server does a rw26> segmentation fault and crashes. Anybody got any ideas what I need rw26> to do? Well, the code above doesn't look too bad to me, except I'd like to know where myev comes from. Is it a function-local variable or something else? Same thing goes for err and ctx. This is clearly a multithread-safety issue. -- Richard Levitte \ Spannvägen 38, II \ [EMAIL PROTECTED] Redakteur@Stacken \ S-161 43 BROMMA \ T: +46-8-26 52 47 \ SWEDEN \ or +46-708-26 53 44 Procurator Odiosus Ex Infernis -- [EMAIL PROTECTED] Unsolicited commercial email is subject to an archival fee of $400. See <http://www.stacken.kth.se/~levitte/mail/> for more info. ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
Re: alignment and thread problem - solaris
Richard Levitte - VMS Whacker Wed, 19 Jan 2000 17:34:10 -0800
- alignment and thread problem - solaris Randy Wright
- Re: alignment and thread problem - sola... Goetz Babin-Ebell
- Re: alignment and thread problem - sola... Richard Levitte - VMS Whacker
- Re: alignment and thread problem - ... Randy Wright
- Re: alignment and thread proble... Richard Levitte - VMS Whacker
- Re: alignment and thread problem - sola... Goetz Babin-Ebell