diff options
author | 2020-08-07 00:45:25 +0000 | |
---|---|---|
committer | 2020-08-07 00:45:25 +0000 | |
commit | a17537c08dc233ec23b087c648b5643d2f8e5eb3 (patch) | |
tree | 448e80204436c2340c60622c2c9141636234da41 | |
parent | delete another word to improve the wording; suggested by jmc@ (diff) | |
download | wireguard-openbsd-a17537c08dc233ec23b087c648b5643d2f8e5eb3.tar.xz wireguard-openbsd-a17537c08dc233ec23b087c648b5643d2f8e5eb3.zip |
timeout(9): remove unused interfaces: timeout_add_ts(9), timeout_add_bt(9)
These two interfaces have been entirely unused since introduction.
Remove them and thin the "timeout" namespace a bit.
Discussed with mpi@ and ratchov@ almost a year ago, though I blocked
the change at that time. Also discussed with visa@.
ok visa@, mpi@
-rw-r--r-- | share/man/man9/timeout.9 | 18 | ||||
-rw-r--r-- | sys/kern/kern_timeout.c | 31 | ||||
-rw-r--r-- | sys/sys/timeout.h | 6 |
3 files changed, 5 insertions, 50 deletions
diff --git a/share/man/man9/timeout.9 b/share/man/man9/timeout.9 index 2935a428d79..052d5e96ad7 100644 --- a/share/man/man9/timeout.9 +++ b/share/man/man9/timeout.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: timeout.9,v 1.50 2020/01/03 02:16:38 cheloha Exp $ +.\" $OpenBSD: timeout.9,v 1.51 2020/08/07 00:45:25 cheloha Exp $ .\" .\" Copyright (c) 2000 Artur Grabowski <art@openbsd.org> .\" All rights reserved. @@ -23,7 +23,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: January 3 2020 $ +.Dd $Mdocdate: August 7 2020 $ .Dt TIMEOUT_SET 9 .Os .Sh NAME @@ -35,8 +35,6 @@ .Nm timeout_add_nsec , .Nm timeout_add_usec , .Nm timeout_add_tv , -.Nm timeout_add_ts , -.Nm timeout_add_bt , .Nm timeout_del , .Nm timeout_del_barrier , .Nm timeout_barrier , @@ -75,10 +73,6 @@ .Ft int .Fn timeout_add_tv "struct timeout *to" "struct timeval *" .Ft int -.Fn timeout_add_ts "struct timeout *to" "struct timespec *" -.Ft int -.Fn timeout_add_bt "struct timeout *to" "struct bintime *" -.Ft int .Fn timeout_add_sec "struct timeout *to" "int sec" .Ft int .Fn timeout_add_msec "struct timeout *to" "int msec" @@ -212,8 +206,6 @@ functions clear the triggered state for that timeout. .Pp When possible, use the .Fn timeout_add_tv , -.Fn timeout_add_ts , -.Fn timeout_add_bt , .Fn timeout_add_sec , .Fn timeout_add_msec , .Fn timeout_add_usec , @@ -257,8 +249,6 @@ context. .Fn timeout_add_nsec , .Fn timeout_add_usec , .Fn timeout_add_tv , -.Fn timeout_add_ts , -.Fn timeout_add_bt , .Fn timeout_del , .Fn timeout_pending , .Fn timeout_initialized , @@ -289,10 +279,8 @@ flag was given at initialization. .Fn timeout_add_msec , .Fn timeout_add_nsec , .Fn timeout_add_usec , -.Fn timeout_add_tv , -.Fn timeout_add_ts , and -.Fn timeout_add_bt +.Fn timeout_add_tv will return 1 if the timeout .Fa to was added to the timeout schedule or 0 if it was already queued. diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index b5393076737..47bee83652e 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_timeout.c,v 1.78 2020/08/06 17:54:08 cheloha Exp $ */ +/* $OpenBSD: kern_timeout.c,v 1.79 2020/08/07 00:45:25 cheloha Exp $ */ /* * Copyright (c) 2001 Thomas Nordin <nordin@openbsd.org> * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org> @@ -306,35 +306,6 @@ timeout_add_tv(struct timeout *to, const struct timeval *tv) } int -timeout_add_ts(struct timeout *to, const struct timespec *ts) -{ - uint64_t to_ticks; - - to_ticks = (uint64_t)hz * ts->tv_sec + ts->tv_nsec / (tick * 1000); - if (to_ticks > INT_MAX) - to_ticks = INT_MAX; - if (to_ticks == 0 && ts->tv_nsec > 0) - to_ticks = 1; - - return timeout_add(to, (int)to_ticks); -} - -int -timeout_add_bt(struct timeout *to, const struct bintime *bt) -{ - uint64_t to_ticks; - - to_ticks = (uint64_t)hz * bt->sec + (long)(((uint64_t)1000000 * - (uint32_t)(bt->frac >> 32)) >> 32) / tick; - if (to_ticks > INT_MAX) - to_ticks = INT_MAX; - if (to_ticks == 0 && bt->frac > 0) - to_ticks = 1; - - return timeout_add(to, (int)to_ticks); -} - -int timeout_add_sec(struct timeout *to, int secs) { uint64_t to_ticks; diff --git a/sys/sys/timeout.h b/sys/sys/timeout.h index c6f02ef89ea..4c6ac5aa37c 100644 --- a/sys/sys/timeout.h +++ b/sys/sys/timeout.h @@ -1,4 +1,4 @@ -/* $OpenBSD: timeout.h,v 1.38 2020/08/01 08:40:20 anton Exp $ */ +/* $OpenBSD: timeout.h,v 1.39 2020/08/07 00:45:25 cheloha Exp $ */ /* * Copyright (c) 2000-2001 Artur Grabowski <art@openbsd.org> * All rights reserved. @@ -113,15 +113,11 @@ int timeout_sysctl(void *, size_t *, void *, size_t); #define TIMEOUT_INITIALIZER(_f, _a) TIMEOUT_INITIALIZER_FLAGS((_f), (_a), 0) -struct bintime; - void timeout_set(struct timeout *, void (*)(void *), void *); void timeout_set_flags(struct timeout *, void (*)(void *), void *, int); void timeout_set_proc(struct timeout *, void (*)(void *), void *); int timeout_add(struct timeout *, int); int timeout_add_tv(struct timeout *, const struct timeval *); -int timeout_add_ts(struct timeout *, const struct timespec *); -int timeout_add_bt(struct timeout *, const struct bintime *); int timeout_add_sec(struct timeout *, int); int timeout_add_msec(struct timeout *, int); int timeout_add_usec(struct timeout *, int); |