Convert ERR_STATE to new multi-threading API

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
Alessandro Ghedini
2016-03-02 17:36:17 +00:00
committed by Alessandro Ghedini
parent f75200115d
commit 8509dcc9f3
7 changed files with 46 additions and 188 deletions

View File

@@ -8,7 +8,7 @@ ERR_remove_thread_state, ERR_remove_state - free a thread's error queue
#include <openssl/err.h>
void ERR_remove_thread_state(const CRYPTO_THREADID *tid);
void ERR_remove_thread_state(void);
Deprecated:
@@ -18,17 +18,16 @@ Deprecated:
=head1 DESCRIPTION
ERR_remove_thread_state() frees the error queue associated with thread B<tid>.
If B<tid> == B<NULL>, the current thread will have its error queue removed.
ERR_remove_thread_state() frees the error queue associated with the current
thread.
Since error queue data structures are allocated automatically for new
threads, they must be freed when threads are terminated in order to
avoid memory leaks.
ERR_remove_state is deprecated and has been replaced by
ERR_remove_thread_state. Since threads in OpenSSL are no longer identified
by unsigned long values any argument to this function is ignored. Calling
ERR_remove_state is equivalent to B<ERR_remove_thread_state(NULL)>.
ERR_remove_thread_state. Any argument to this function is ignored and
calling ERR_remove_state is equivalent to B<ERR_remove_thread_state()>.
=head1 RETURN VALUE
@@ -41,7 +40,6 @@ L<err(3)>
=head1 HISTORY
ERR_remove_state()
was deprecated in OpenSSL 1.0.0 when ERR_remove_thread_state() was introduced
and thread IDs were introduced to identify threads instead of 'unsigned long'.
was deprecated in OpenSSL 1.0.0 when ERR_remove_thread_state() was introduced.
=cut

View File

@@ -22,7 +22,7 @@ err - error codes
int ERR_GET_REASON(unsigned long e);
void ERR_clear_error(void);
void ERR_remove_thread_state(const CRYPTO_THREADID *tid);
void ERR_remove_thread_state(void);
char *ERR_error_string(unsigned long e, char *buf);
const char *ERR_lib_error_string(unsigned long e);
@@ -164,15 +164,14 @@ TBA more details
=head1 INTERNALS
The error queues are stored in a hash table with one B<ERR_STATE>
entry for each pid. ERR_get_state() returns the current thread's
The error queues are stored in a thread-local storage with one B<ERR_STATE>
entry for each thread. ERR_get_state() returns the current thread's
B<ERR_STATE>. An B<ERR_STATE> can hold up to B<ERR_NUM_ERRORS> error
codes. When more error codes are added, the old ones are overwritten,
on the assumption that the most recent errors are most important.
Error strings are also stored in hash table. The hash tables can
be obtained by calling ERR_get_err_state_table(void) and
ERR_get_string_table(void) respectively.
Error strings are also stored in a hash table that can be obtained
by calling ERR_get_string_table(void).
=head1 SEE ALSO