aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2026-02-25 23:19:56 +0000
committerEnji Cooper <ngie@FreeBSD.org>2026-02-25 23:34:32 +0000
commit2a6c2d9c38dc421025b6c18cac68fe9965c574c0 (patch)
treebcec1e4fa1c7d9d390a787bb136a9c48d3aea325 /lib
parent42ab99095b7dc2243629574e1c627cf5e6a9070c (diff)
Diffstat (limited to 'lib')
-rw-r--r--lib/libnetbsd/math.h14
-rw-r--r--lib/libnetbsd/sys/time.h35
2 files changed, 49 insertions, 0 deletions
diff --git a/lib/libnetbsd/math.h b/lib/libnetbsd/math.h
new file mode 100644
index 000000000000..bffc94f82d67
--- /dev/null
+++ b/lib/libnetbsd/math.h
@@ -0,0 +1,14 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 Enji Cooper
+ */
+
+#ifndef __LIBNETBSD_MATH_H__
+#define __LIBNETBSD_MATH_H__
+
+#include_next <math.h>
+
+#define isinff(x) __isinff(x)
+
+#endif
diff --git a/lib/libnetbsd/sys/time.h b/lib/libnetbsd/sys/time.h
new file mode 100644
index 000000000000..9ddde16e84e3
--- /dev/null
+++ b/lib/libnetbsd/sys/time.h
@@ -0,0 +1,35 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 Enji Cooper
+ */
+
+#ifndef _LIBNETBSD_SYS_TIME_H_
+#define _LIBNETBSD_SYS_TIME_H_
+
+#include_next <sys/time.h>
+
+#define timercmp(tvp, uvp, cmp) \
+ (((tvp)->tv_sec == (uvp)->tv_sec) ? \
+ ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
+ ((tvp)->tv_sec cmp (uvp)->tv_sec))
+#define timespecadd(tsp, usp, vsp) \
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec >= 1000000000L) { \
+ (vsp)->tv_sec++; \
+ (vsp)->tv_nsec -= 1000000000L; \
+ } \
+ } while (0)
+#define timespecsub(tsp, usp, vsp) \
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec < 0) { \
+ (vsp)->tv_sec--; \
+ (vsp)->tv_nsec += 1000000000L; \
+ } \
+ } while (0)
+
+#endif