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 58019c9a12
but being able to build the library without installed sources would be
extremely useful.

Reviewed By:	gnn
Differential Revision: https://reviews.freebsd.org/D27884
This commit is contained in:
Alex Richardson 2021-01-06 15:39:10 +00:00 committed by Alex Richardson
parent 74bd207697
commit 1f6612b444
2 changed files with 19 additions and 2 deletions

View File

@ -64,6 +64,13 @@ FILES= ${DSRCS}
FILESDIR= /usr/lib/dtrace FILESDIR= /usr/lib/dtrace
FILESMODE= ${NOBINMODE} 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 WARNS?= 1
CFLAGS+= -DIN_BASE CFLAGS+= -DIN_BASE

View File

@ -49,10 +49,20 @@ extern "C" {
#ifndef _ASM #ifndef _ASM
#include <sys/types.h> #include <sys/param.h>
#include <sys/stdint.h>
#ifdef _KERNEL #ifdef _KERNEL
#include <sys/endian.h> #include <sys/endian.h>
#endif #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/modctl.h>
#include <sys/processor.h> #include <sys/processor.h>
#include <sys/cpuvar.h> #include <sys/cpuvar.h>
@ -63,9 +73,9 @@ extern "C" {
#include <sys/proc.h> #include <sys/proc.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/ucred.h> #include <sys/ucred.h>
#endif
typedef int model_t; typedef int model_t;
#include <sys/ctf_api.h> #include <sys/ctf_api.h>
#include <sys/stdint.h>
/* /*
* DTrace Universal Constants and Typedefs * DTrace Universal Constants and Typedefs