[openssl.org #1096] Minor documentation bugs

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[openssl.org #1096] Minor documentation bugs

Rich Salz via RT

http://www.openssl.org/docs/crypto/threads.html says

1
        #if defined(THREADS)

I suspect that this should say:

        #if defined(OPENSSL_THREADS)

I compiled for threads (seemed to be the default) and I saw
-DOPENSSL_THREADS.  When I try the test, THREADS is not defined but
OPENSSL_THREADS is.

2

"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)."

On my Linux system, getpid() returns the same pid for each thread.
I'm told that this is the correct Posix behavior, although a Google
search showed that early Linux did not do that.

I suggest pthread_self() as the callback function.

--
Ken Goldman   [hidden email]   914-784-7646

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: [openssl.org #1096] Minor documentation bugs

David C. Partridge
The problem with pthread_self() is that the value it returns is defined to
be "opaque", and isn't necessarily (e.g.) and unsigned long (32 bit), though
many Unix and Unix like systems do use a 32 bit value ...

Dave


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [openssl.org #1096] Minor documentation bugs

Dan Kegel-2
In reply to this post by Rich Salz via RT
Ken Goldman via RT wrote:

> http://www.openssl.org/docs/crypto/threads.html says
> ...
>
> "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)."
>
> On my Linux system, getpid() returns the same pid for each thread.
> I'm told that this is the correct Posix behavior, although a Google
> search showed that early Linux did not do that.

How about the replacement text

  "id_function(void) is a function that returns a thread ID, for instance,
  pthread_self(). It is not, needed on Windows nor on platforms where getpid()
  returns a different ID for each thread.  However, even on those platforms,
  pthread_self() should be used, since the behavior of getpid() may depend
  on the machine where the program is being run, not the machine where
  the program is being compiled.
  (For instance, Red Hat 8 Linux and earlier
  used LinuxThreads, whose getpid() returns a different value for each thread;
  Red Hat 9 Linux and later use NPTL, which is Posix-conformant, and thus
  whose getpid() returns the same value for each thread in a process.
  But a program compiled on Red Hat 8 and run on Red Hat 9 will
  by default see getpid() returning the same value for all threads.)

Or something shorter but still as enlightening :-)

--
Trying to get a job as a c++ developer?  See http://kegel.com/academy/getting-hired.html
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]