Skip to content

Commit

Permalink
Install dtrace.h and dependencies
Browse files Browse the repository at this point in the history
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 tmetsch/python-dtrace@58019c9
but being able to build the library without installed sources would be
extremely useful.

Reviewed By:	gnn
Differential Revision: https://reviews.freebsd.org/D27884
  • Loading branch information
arichardson committed Jan 7, 2021
1 parent 74bd207 commit 1f6612b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions cddl/lib/libdtrace/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions sys/cddl/contrib/opensolaris/uts/common/sys/dtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Expand Down

0 comments on commit 1f6612b

Please sign in to comment.