aboutsummaryrefslogtreecommitdiff
path: root/include/sys
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-10-16 17:41:25 +0300
committerCem Keylan <cem@ckyln.com>2020-10-16 17:41:25 +0300
commite2abcdca396661cbe0ae2ddb13d5c2b85682c13a (patch)
treeacf9b5c80b645617f882c45224c6e07251711842 /include/sys
downloadotools-e2abcdca396661cbe0ae2ddb13d5c2b85682c13a.tar.gz
initial commit
Diffstat (limited to 'include/sys')
-rw-r--r--include/sys/cdefs.h5
-rw-r--r--include/sys/param.h3
-rw-r--r--include/sys/time.h14
3 files changed, 22 insertions, 0 deletions
diff --git a/include/sys/cdefs.h b/include/sys/cdefs.h
new file mode 100644
index 0000000..70258b8
--- /dev/null
+++ b/include/sys/cdefs.h
@@ -0,0 +1,5 @@
+/* only needed for C++ */
+#define __BEGIN_DECLS
+#define __END_DECLS
+
+#define __dead __attribute__((__noreturn__))
diff --git a/include/sys/param.h b/include/sys/param.h
new file mode 100644
index 0000000..3167713
--- /dev/null
+++ b/include/sys/param.h
@@ -0,0 +1,3 @@
+#include_next <sys/param.h>
+#define ALIGNBYTES (sizeof(uintptr_t) - 1)
+#define ALIGN(p) (((uintptr_t)(p) + ALIGNBYTES) &~ ALIGNBYTES)
diff --git a/include/sys/time.h b/include/sys/time.h
new file mode 100644
index 0000000..f4f151f
--- /dev/null
+++ b/include/sys/time.h
@@ -0,0 +1,14 @@
+#include_next <sys/time.h>
+#define timespeccmp(tsp, usp, cmp) \
+ (((tsp)->tv_sec == (usp)->tv_sec) ? \
+ ((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
+ ((tsp)->tv_sec cmp (usp)->tv_sec))
+#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)