git: 1f6612b444e3 - main - Install dtrace.h and dependencies

Alex Richardson arichardson at FreeBSD.org
Thu Jan 7 11:05:57 UTC 2021


The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=1f6612b444e3fc54697a4ef3167efdddff6944ea

commit 1f6612b444e3fc54697a4ef3167efdddff6944ea
Author:     Alex Richardson <Alexander.Richardson at cl.cam.ac.uk>
AuthorDate: 2021-01-06 15:39:10 +0000
Commit:     Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-01-07 09:26:21 +0000

    Install dtrace.h and dependencies
    
    This makes the minimum amount of changes to allow inclusion of dtrace.h
    without all the solaris compatibility headers. Installing dtrace.h allows
    compiling consumers of libdtrace (e.g. https://github.com/tmetsch/python-dtrace)
    without requiring a copy of the source tree.
    For python-dtrace I worked around this in https://github.com/tmetsch/python-dtrace/commit/58019c9a12022203a9ffda286dd8b41f1a5ace42
    but being able to build the library without installed sources would be
    extremely useful.
    
    Reviewed By:    gnn
    Differential Revision: https://reviews.freebsd.org/D27884
---
 cddl/lib/libdtrace/Makefile                          |  7 +++++++
 sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h | 14 ++++++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile
index d0184185ff74..efd73751e2c0 100644
--- a/cddl/lib/libdtrace/Makefile
+++ b/cddl/lib/libdtrace/Makefile
@@ -64,6 +64,13 @@ FILES=		${DSRCS}
 FILESDIR=	/usr/lib/dtrace
 FILESMODE=	${NOBINMODE}
 
+INCSGROUPS=	INCS SYSINCS
+SYSINCSDIR=	${INCLUDEDIR}/sys
+INCS+=		${SRCTOP}/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
+SYSINCS+=	${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
+SYSINCS+=	${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf_api.h
+SYSINCS+=	${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/sys/ctf.h
+
 WARNS?=		1
 
 CFLAGS+= -DIN_BASE
diff --git a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
index b9ee9095d17d..31c5983270ca 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
+++ b/sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
@@ -49,10 +49,20 @@ extern "C" {
 
 #ifndef _ASM
 
-#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/stdint.h>
 #ifdef _KERNEL
 #include <sys/endian.h>
 #endif
+#if !defined(IN_BASE) && !defined(_KERNEL)
+/* Compatibility types to allow including the CTF API */
+typedef unsigned int zoneid_t;
+typedef unsigned char uchar_t;
+typedef unsigned short ushort_t;
+typedef unsigned int uint_t;
+typedef unsigned long ulong_t;
+typedef int processorid_t;
+#else
 #include <sys/modctl.h>
 #include <sys/processor.h>
 #include <sys/cpuvar.h>
@@ -63,9 +73,9 @@ extern "C" {
 #include <sys/proc.h>
 #include <sys/types.h>
 #include <sys/ucred.h>
+#endif
 typedef int model_t;
 #include <sys/ctf_api.h>
-#include <sys/stdint.h>
 
 /*
  * DTrace Universal Constants and Typedefs


More information about the dev-commits-src-all mailing list