summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys
diff options
context:
space:
mode:
authorcheloha <cheloha@openbsd.org>2019-01-18 09:36:47 +0000
committercheloha <cheloha@openbsd.org>2019-01-18 09:36:47 +0000
commit5b065b4438696aba983548a63aca71c66870416b (patch)
tree7841c564c25b501adc571685d7175d9bcac37fd9 /lib/libc/sys
parentSayt that using capabilities to negociate audio parameters (ie using (diff)
downloadwireguard-openbsd-5b065b4438696aba983548a63aca71c66870416b.tar.xz
wireguard-openbsd-5b065b4438696aba983548a63aca71c66870416b.zip
sys/time.h: new macros: timerisvalid() and timespecisvalid().
Make it less likely you miss a zero when typing out 100000 or 100000000. Document them in getitimer.2 for the masses. These may be of use in library code as well as the kernel. Comparable inline functions exist in Linux but are not available to userspace like these. "OK." deraadt@
Diffstat (limited to 'lib/libc/sys')
-rw-r--r--lib/libc/sys/getitimer.212
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/libc/sys/getitimer.2 b/lib/libc/sys/getitimer.2
index e569ba53a6a..8dc06adf3cb 100644
--- a/lib/libc/sys/getitimer.2
+++ b/lib/libc/sys/getitimer.2
@@ -1,4 +1,4 @@
-.\" $OpenBSD: getitimer.2,v 1.29 2015/11/10 23:48:18 jmc Exp $
+.\" $OpenBSD: getitimer.2,v 1.30 2019/01/18 09:36:47 cheloha Exp $
.\" $NetBSD: getitimer.2,v 1.6 1995/10/12 15:40:54 jtc Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)getitimer.2 8.2 (Berkeley) 12/11/93
.\"
-.Dd $Mdocdate: November 10 2015 $
+.Dd $Mdocdate: January 18 2019 $
.Dt GETITIMER 2
.Os
.Sh NAME
@@ -38,6 +38,7 @@
.Nm setitimer ,
.Nm timerclear ,
.Nm timerisset ,
+.Nm timerisvalid ,
.Nm timercmp ,
.Nm timersub ,
.Nm timeradd
@@ -57,6 +58,8 @@
.Ft int
.Fn timerisset "struct timeval *"
.Ft int
+.Fn timerisvalid "struct timeval *"
+.Ft int
.Fn timercmp "struct timeval *a" "struct timeval *b" CMP
.Ft void
.Fn timersub "struct timeval *a" "struct timeval *b" "struct timeval *res"
@@ -156,6 +159,11 @@ tests if the time value in
.Fa a
is non-zero.
.Pp
+.Fn timerisvalid "a"
+tests if the microsecond value in
+.Fa a
+is greater than or equal to zero and less than 1 million.
+.Pp
.Fn timercmp a b CMP
compares two time values in the form
.Fa a