提交 ffcca684 编写于 作者: A Andy Polyakov

apps/speed.c: clean up SIGARM handling.

Reviewed-by: NTim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6311)
上级 1e8d5ea5
...@@ -197,29 +197,29 @@ static const int lengths_list[] = { ...@@ -197,29 +197,29 @@ static const int lengths_list[] = {
}; };
static const int *lengths = lengths_list; static const int *lengths = lengths_list;
#define START 0
#define STOP 1
#ifdef SIGALRM #ifdef SIGALRM
# if defined(__STDC__) || defined(sgi) || defined(_AIX)
# define SIGRETTYPE void
# else
# define SIGRETTYPE int
# endif
static SIGRETTYPE sig_done(int sig); static void alarmed(int sig)
static SIGRETTYPE sig_done(int sig)
{ {
signal(SIGALRM, sig_done); signal(SIGALRM, alarmed);
run = 0; run = 0;
} }
#endif
#define START 0 static double Time_F(int s)
#define STOP 1 {
double ret = app_tminterval(s, usertime);
if (s == STOP)
alarm(0);
return ret;
}
#if defined(_WIN32) #elif defined(_WIN32)
# define SIGALRM -1
# if !defined(SIGALRM)
# define SIGALRM
# endif
static unsigned int lapse; static unsigned int lapse;
static volatile unsigned int schlock; static volatile unsigned int schlock;
static void alarm_win32(unsigned int secs) static void alarm_win32(unsigned int secs)
...@@ -263,13 +263,9 @@ static double Time_F(int s) ...@@ -263,13 +263,9 @@ static double Time_F(int s)
return ret; return ret;
} }
#else #else
static double Time_F(int s) static double Time_F(int s)
{ {
double ret = app_tminterval(s, usertime); return app_tminterval(s, usertime);
if (s == STOP)
alarm(0);
return ret;
} }
#endif #endif
...@@ -1961,10 +1957,8 @@ int speed_main(int argc, char **argv) ...@@ -1961,10 +1957,8 @@ int speed_main(int argc, char **argv)
/* not worth fixing */ /* not worth fixing */
# error "You cannot disable DES on systems without SIGALRM." # error "You cannot disable DES on systems without SIGALRM."
# endif /* OPENSSL_NO_DES */ # endif /* OPENSSL_NO_DES */
#else #elif SIGALRM > 0
# ifndef _WIN32 signal(SIGALRM, alarmed);
signal(SIGALRM, sig_done);
# endif
#endif /* SIGALRM */ #endif /* SIGALRM */
#ifndef OPENSSL_NO_MD2 #ifndef OPENSSL_NO_MD2
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册