aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c1
-rw-r--r--cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h10
-rw-r--r--sys/cddl/compat/opensolaris/sys/stat.h13
-rw-r--r--sys/cddl/compat/opensolaris/sys/time.h1
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h9
5 files changed, 31 insertions, 3 deletions
diff --git a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
index c35b1a526d21..f48c09cce0e2 100644
--- a/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
+++ b/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
+#include <sys/endian.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/zmod.h>
diff --git a/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h b/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h
index c8d272faa419..b7da16ac3ddd 100644
--- a/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h
+++ b/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h
@@ -38,6 +38,7 @@
#include <pthread.h>
#include <sys/ccompile.h>
+#include <sys/endian.h>
#ifdef __cplusplus
extern "C" {
@@ -65,6 +66,15 @@ extern "C" {
#define MIN(a, b) ((a) > (b) ? (b) : (a))
#endif
+/* Sanity check for cross-build bootstrap tools */
+#if !defined(BYTE_ORDER)
+#error "Missing BYTE_ORDER defines"
+#elif !defined(_LITTLE_ENDIAN)
+#error "Missing _LITTLE_ENDIAN defines"
+#elif !defined(_BIG_ENDIAN)
+#error "Missing _BIG_ENDIAN defines"
+#endif
+
#define TRUE 1
#define FALSE 0
diff --git a/sys/cddl/compat/opensolaris/sys/stat.h b/sys/cddl/compat/opensolaris/sys/stat.h
index d7301841d08b..05b9671789dd 100644
--- a/sys/cddl/compat/opensolaris/sys/stat.h
+++ b/sys/cddl/compat/opensolaris/sys/stat.h
@@ -32,11 +32,19 @@
#include_next <sys/stat.h>
+/*
+ * When bootstrapping on Linux a stat64/fstat64 functions exists in both
+ * glibc and musl libc. To avoid compilation errors, use those functions instead
+ * of redefining them to stat/fstat.
+ * Similarly, macOS provides (deprecated) stat64 functions that we can use
+ * for now.
+ */
+#if !defined(__linux__) && !defined(__APPLE__)
#define stat64 stat
#define MAXOFFSET_T OFF_MAX
-#ifndef _KERNEL
+#if !defined(_KERNEL)
#include <sys/disk.h>
static __inline int
@@ -51,6 +59,7 @@ fstat64(int fd, struct stat *sb)
}
return (ret);
}
-#endif
+#endif /* !defined(_KERNEL) */
+#endif /* !defined(__linux__) && !defined(__APPLE__) */
#endif /* !_COMPAT_OPENSOLARIS_SYS_STAT_H_ */
diff --git a/sys/cddl/compat/opensolaris/sys/time.h b/sys/cddl/compat/opensolaris/sys/time.h
index 64dd9bb9f918..5f51d08550f4 100644
--- a/sys/cddl/compat/opensolaris/sys/time.h
+++ b/sys/cddl/compat/opensolaris/sys/time.h
@@ -29,6 +29,7 @@
#ifndef _OPENSOLARIS_SYS_TIME_H_
#define _OPENSOLARIS_SYS_TIME_H_
+#include <sys/types.h>
#include_next <sys/time.h>
#define SEC 1
diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h b/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h
index 675e4893aa1d..7b738c8b0d13 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h
@@ -46,8 +46,12 @@ extern "C" {
/*
* Disk blocks (sectors) and bytes.
*/
+#ifndef dtob
#define dtob(DD) ((DD) << DEV_BSHIFT)
+#endif
+#ifndef btod
#define btod(BB) (((BB) + DEV_BSIZE - 1) >> DEV_BSHIFT)
+#endif
#define btodt(BB) ((BB) >> DEV_BSHIFT)
#define lbtod(BB) (((offset_t)(BB) + DEV_BSIZE - 1) >> DEV_BSHIFT)
@@ -220,9 +224,12 @@ extern unsigned char bcd_to_byte[256];
/*
* Macros for counting and rounding.
*/
+#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y))
+#endif
+#ifndef roundup
#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
-
+#endif
/*
* Macro to determine if value is a power of 2
*/