summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjca <jca@openbsd.org>2017-12-05 15:02:06 +0000
committerjca <jca@openbsd.org>2017-12-05 15:02:06 +0000
commit2bd895b2a33f30c2dbbea92dc18083299fe7ad62 (patch)
tree9a83a6f54ad302371fee15277a7ef0a50bf33950
parentWhen removing duplicate dynamic leases from the cache, compare the (diff)
downloadwireguard-openbsd-2bd895b2a33f30c2dbbea92dc18083299fe7ad62.tar.xz
wireguard-openbsd-2bd895b2a33f30c2dbbea92dc18083299fe7ad62.zip
Seperate real and user timer interfaces
Use more descriptive names, and make it clearer that real and user timers work on different static storage. The end goal is to be able to reuse those timer functions, instead of inlining other timer implementations subject to clock jumps. Discussed with Scott Cheloha
-rw-r--r--usr.bin/openssl/apps.h5
-rw-r--r--usr.bin/openssl/apps_posix.c14
-rw-r--r--usr.bin/openssl/s_time.c6
-rw-r--r--usr.bin/openssl/speed.c7
4 files changed, 15 insertions, 17 deletions
diff --git a/usr.bin/openssl/apps.h b/usr.bin/openssl/apps.h
index 4276e533f7f..d02169b8aaf 100644
--- a/usr.bin/openssl/apps.h
+++ b/usr.bin/openssl/apps.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: apps.h,v 1.19 2016/08/30 14:34:59 deraadt Exp $ */
+/* $OpenBSD: apps.h,v 1.20 2017/12/05 15:02:06 jca Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -279,7 +279,8 @@ int app_isdir(const char *);
#define TM_START 0
#define TM_STOP 1
-double app_tminterval (int stop, int usertime);
+double app_timer_real(int stop);
+double app_timer_user(int stop);
#define OPENSSL_NO_SSL_INTERN
diff --git a/usr.bin/openssl/apps_posix.c b/usr.bin/openssl/apps_posix.c
index 94c6d35f714..502919c0a2a 100644
--- a/usr.bin/openssl/apps_posix.c
+++ b/usr.bin/openssl/apps_posix.c
@@ -123,8 +123,8 @@
#include "apps.h"
-static double
-real_interval(int stop)
+double
+app_timer_real(int stop)
{
static struct timespec start;
struct timespec elapsed, now;
@@ -138,8 +138,8 @@ real_interval(int stop)
return 0.0;
}
-static double
-user_interval(int stop)
+double
+app_timer_user(int stop)
{
static struct timeval start;
struct timeval elapsed;
@@ -154,12 +154,6 @@ user_interval(int stop)
return 0.0;
}
-double
-app_tminterval(int stop, int usertime)
-{
- return (usertime) ? user_interval(stop) : real_interval(stop);
-}
-
int
setup_ui(void)
{
diff --git a/usr.bin/openssl/s_time.c b/usr.bin/openssl/s_time.c
index e7a1ef7b631..75009f86175 100644
--- a/usr.bin/openssl/s_time.c
+++ b/usr.bin/openssl/s_time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s_time.c,v 1.18 2017/11/02 00:31:49 mestre Exp $ */
+/* $OpenBSD: s_time.c,v 1.19 2017/12/05 15:02:06 jca Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -233,9 +233,9 @@ s_time_usage(void)
#define STOP 1
static double
-tm_Time_F(int s)
+tm_Time_F(int op)
{
- return app_tminterval(s, 1);
+ return app_timer_user(op);
}
/***********************************************************************
diff --git a/usr.bin/openssl/speed.c b/usr.bin/openssl/speed.c
index 90cf6de0110..4238b15f614 100644
--- a/usr.bin/openssl/speed.c
+++ b/usr.bin/openssl/speed.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: speed.c,v 1.20 2017/10/07 06:16:54 guenther Exp $ */
+/* $OpenBSD: speed.c,v 1.21 2017/12/05 15:02:06 jca Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -202,7 +202,10 @@ sig_done(int sig)
static double
Time_F(int s)
{
- return app_tminterval(s, usertime);
+ if (usertime)
+ return app_timer_user(s);
+ else
+ return app_timer_real(s);
}