Date: Tue, 25 Feb 2003 10:57:24 -0500 From: Craig Rodrigues <rodrigc@attbi.com> To: freebsd-current@freebsd.org Cc: freebsd-security@freebsd.org Subject: OpenSSL question for id_function() Message-ID: <20030225155724.GB9400@attbi.com>
next in thread | raw e-mail | index | archive | help
Hi, I have a question about OpenSSL 0.9.7. On the following web page: http://www.openssl.org/docs/crypto/threads.html "void CRYPTO_set_id_callback(unsigned long (*id_function)(void)); id_function(void) is a function that returns a thread ID. It is not needed on Windows nor on platforms where getpid() returns a different ID for each thread (most notably Linux)." I have some third party C++ code which tries to implement this id_function as: return static_cast<unsigned long>(pthread_self()); pthread_self() returns something of type pthread_t. This code works under Linux, because pthread_t is mapped to an integer value. However, on FreeBSD, pthread_t is a pointer to struct pthread, so this code does not compile: OpenSSLPluginI.cpp: In function `long unsigned int IceSSL::idFunction()': OpenSSLPluginI.cpp:153: invalid static_cast from type `pthread*' to type `long unsigned int' Is there a way to implement the id_function() for OpenSSL so that it works portably across FreeBSD and Linux? Thanks. -- Craig Rodrigues http://home.attbi.com/~rodrigc rodrigc@attbi.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-security" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030225155724.GB9400>