[DTrace-devel] [PATCH] Ensure all datatypes are available for compilation

Kris Van Hees kris.van.hees at oracle.com
Wed Mar 4 07:49:05 PST 2020


The changes to make building against libctf as an alternative to
libdtrace-ctf caused a compilation failure if libdtrace-ctf was not
installed.  The cause was a dependency on some datatype declarations
defined by the libdtrace-ctf include files.  These declarations have
been moved to dtrace_types.h to ensure that they are available
regardless of which CTF library is used during compilation.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 uts/common/sys/dtrace_types.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/uts/common/sys/dtrace_types.h b/uts/common/sys/dtrace_types.h
index 1eda9d4e..16d2d912 100644
--- a/uts/common/sys/dtrace_types.h
+++ b/uts/common/sys/dtrace_types.h
@@ -10,12 +10,19 @@
 
 #include <sys/types.h>
 #include <stdint.h>
-#include <sys/ctf_types.h>
 #include <endian.h>
 #include <unistd.h>
 
 typedef enum { B_FALSE, B_TRUE} boolean_t;
 
+/*
+ * POSIX Extensions
+ */
+typedef unsigned char	uchar_t;
+typedef unsigned short	ushort_t;
+typedef unsigned int	uint_t;
+typedef unsigned long	ulong_t;
+
 /*
  * Strictly conforming ANSI C environments prior to the 1999
  * revision of the C Standard (ISO/IEC 9899:1999) do not have
@@ -75,6 +82,13 @@ typedef unsigned long long hrtime_t;
 #warning Unknown endianness
 #endif
 
+/*
+ * return x rounded up to an alignment boundary
+ * eg, P2ROUNDUP(0x1234, 0x100) == 0x1300 (0x13*align)
+ * eg, P2ROUNDUP(0x5600, 0x100) == 0x5600 (0x56*align)
+ */
+#define P2ROUNDUP(x, align)	(-(-(x) & -(align)))
+
 /*
  * This comes from <linux/dtrace_os.h>.
  */
-- 
2.25.0




More information about the DTrace-devel mailing list