Some platforms provide getcontext() but it does not work
Some platforms claim to be POSIX but their getcontext() implementation does not work. Therefore we update the ASYNC_is_capable() function to test for this. RT#4366 Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
committed by
Richard Levitte
parent
685b6f293b
commit
c521edc3a1
@@ -62,7 +62,13 @@
|
|||||||
|
|
||||||
int ASYNC_is_capable(void)
|
int ASYNC_is_capable(void)
|
||||||
{
|
{
|
||||||
return 1;
|
ucontext_t ctx;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Some platforms provide getcontext() but it does not work (notably
|
||||||
|
* MacOSX PPC64). Check for a working getcontext();
|
||||||
|
*/
|
||||||
|
return getcontext(&ctx) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void async_local_cleanup(void)
|
void async_local_cleanup(void)
|
||||||
|
|||||||
@@ -61,21 +61,6 @@
|
|||||||
#include <openssl/crypto.h>
|
#include <openssl/crypto.h>
|
||||||
#include <../apps/apps.h>
|
#include <../apps/apps.h>
|
||||||
|
|
||||||
#if (defined(OPENSSL_SYS_UNIX) || defined(OPENSSL_SYS_CYGWIN)) && defined(OPENSSL_THREADS)
|
|
||||||
# include <unistd.h>
|
|
||||||
# if _POSIX_VERSION >= 200112L
|
|
||||||
# define ASYNC_POSIX
|
|
||||||
# endif
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
# define ASYNC_WIN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(ASYNC_POSIX) && !defined(ASYNC_WIN)
|
|
||||||
# define ASYNC_NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ASYNC_NULL
|
|
||||||
|
|
||||||
static int ctr = 0;
|
static int ctr = 0;
|
||||||
static ASYNC_JOB *currjob = NULL;
|
static ASYNC_JOB *currjob = NULL;
|
||||||
|
|
||||||
@@ -308,14 +293,12 @@ static int test_ASYNC_block_pause()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
if (!ASYNC_is_capable()) {
|
||||||
#ifdef ASYNC_NULL
|
fprintf(stderr,
|
||||||
fprintf(stderr, "NULL implementation - skipping async tests\n");
|
"OpenSSL build is not ASYNC capable - skipping async tests\n");
|
||||||
#else
|
} else {
|
||||||
CRYPTO_set_mem_debug(1);
|
CRYPTO_set_mem_debug(1);
|
||||||
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
|
||||||
|
|
||||||
@@ -326,7 +309,7 @@ int main(int argc, char **argv)
|
|||||||
|| !test_ASYNC_block_pause()) {
|
|| !test_ASYNC_block_pause()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
printf("PASS\n");
|
printf("PASS\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user