From 1f6612b444e3fc54697a4ef3167efdddff6944ea Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Wed, 6 Jan 2021 15:39:10 +0000 Subject: [PATCH] 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 +++++++ .../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 d0184185ff7..efd73751e2c 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 b9ee9095d17..31c5983270c 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 +#include +#include #ifdef _KERNEL #include #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 #include #include @@ -63,9 +73,9 @@ extern "C" { #include #include #include +#endif typedef int model_t; #include -#include /* * DTrace Universal Constants and Typedefs -- 2.45.0