# run fuzz tests before system tests
SUBDIRS += fuzz bin
-BUILT_SOURCES = bind.keys.h
-CLEANFILES = bind.keys.h
+BUILT_SOURCES += bind.keys.h
+CLEANFILES += bind.keys.h
bind.keys.h: bind.keys Makefile
${PERL} ${top_srcdir}/util/bindkeys.pl ${top_srcdir}/bind.keys > $@
EXTRA_DIST = \
bind.keys \
util/bindkeys.pl \
+ util/dtrace.sh \
contrib \
CHANGES \
COPYRIGHT \
--- /dev/null
+# Hey Emacs, this is -*- makefile-automake -*- file!
+# vim: filetype=automake
+
+AM_V_DTRACE = $(AM_V_DTRACE_@AM_V@)
+AM_V_DTRACE_ = $(AM_V_DTRACE_@AM_DEFAULT_V@)
+AM_V_DTRACE_0 = @echo " DTRACE $@";
+
+BUILT_SOURCES += probes.h
+CLEANFILES += probes.h probes.o
+
+probes.h: probes.d
+ $(AM_V_DTRACE)$(DTRACE) -s $(srcdir)/probes.d -h -o $@
+probes.lo: probes.d $(DTRACE_DEPS)
+ $(AM_V_DTRACE)$(LIBTOOL) --mode=compile --tag=CC $(DTRACE) -s $(srcdir)/probes.d -G -o $@ $(DTRACE_OBJS)
+
+if HAVE_DTRACE
+DTRACE_LIBADD = probes.lo
+endif
$(STD_LDFLAGS)
LDADD =
+BUILT_SOURCES =
+CLEANFILES =
+
if HOST_MACOS
AM_LDFLAGS += \
-Wl,-flat_namespace
-I$(top_builddir)/lib/isc/include
LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la
+if HAVE_DTRACE
+LIBISC_DTRACE = $(top_builddir)/lib/isc/probes.lo
+endif
LIBDNS_CFLAGS = \
-I$(top_srcdir)/lib/dns/include \
LIBDNS_LIBS = \
$(top_builddir)/lib/dns/libdns.la
+if HAVE_DTRACE
+LIBDNS_DTRACE = $(top_builddir)/lib/dns/probes.lo
+endif
LIBNS_CFLAGS = \
-I$(top_srcdir)/lib/ns/include
LIBNS_LIBS = \
$(top_builddir)/lib/ns/libns.la
+if HAVE_DTRACE
+LIBNS_DTRACE = $(top_builddir)/lib/ns/probes.lo
+endif
LIBISCCFG_CFLAGS = \
-I$(top_srcdir)/lib/isccfg/include
sbin_PROGRAMS = named
nodist_named_SOURCES = xsl.c
-BUILT_SOURCES = xsl.c
-CLEANFILES = xsl.c
+BUILT_SOURCES += xsl.c
+CLEANFILES += xsl.c
EXTRA_DIST = bind9.xsl
AX_GCC_FUNC_ATTRIBUTE([constructor])
AX_GCC_FUNC_ATTRIBUTE([destructor])
+#
+# Check whether to enable User Statically Defined Tracing.
+#
+# This is supported only on Linux now and requires SystemTap libraries.
+#
+# [pairwise: --enable-tracing=auto, --enable-tracing=yes, --disable-tracing]
+AC_ARG_ENABLE([tracing],
+ [AS_HELP_STRING([--enable-tracing],
+ [enable User Statically Defined Tracing])],
+ [],
+ [enable_tracing=auto])
+
+AC_ARG_VAR([DTRACE], [path to dtrace binary used to build User Statically Defined Tracing probes])
+AC_PATH_PROGS([DTRACE], [dtrace])
+AC_CHECK_HEADERS([sys/sdt.h])
+
+AC_MSG_CHECKING([whether to enable User Statically Defined Tracing support (default is auto)])
+AS_CASE([$enable_tracing],
+ [auto], [enable_tracing=yes
+ AS_IF([test "$ac_cv_header_sys_sdt_h" != "yes"], [enable_tracing=no])
+ AS_IF([test -z "$DTRACE"],[enable_tracing=no])
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[]],
+ [[#if !defined(__has_feature)
+ #define __has_feature(x) 0
+ #endif /* if !defined(__has_feature) */
+ #if __has_feature(address_sanitizer)
+ #define __SANITIZE_ADDRESS__ 1
+ #endif /* if __has_feature(address_sanitizer) */
+ #if defined(__SANITIZE_ADDRESS__)
+ #error Address Sanitizer enabled
+ #endif
+ ]])],
+ [],
+ [enable_tracing=no]
+ )])
+AS_CASE([$enable_tracing],
+ [yes], [AS_IF([test "$ac_cv_header_sys_sdt_h" != "yes"],
+ [AC_MSG_ERROR([sys/sdt.h header not found])])
+ AS_IF([test -z "$DTRACE"],
+ [AC_MSG_ERROR([The dtrace command not found])])
+ AC_MSG_RESULT([yes])],
+ [DTRACE=""
+ AC_MSG_RESULT([no])])
+
+AS_CASE([$host],
+ [*-linux*],[have_systemtap=true])
+
+AM_CONDITIONAL([HAVE_SYSTEMTAP], [test -n "$have_systemtap"])
+AM_CONDITIONAL([HAVE_DTRACE], [test -n "$DTRACE"])
+
+# Use shim script if dtrace is not available
+AS_IF([test -z "$DTRACE"],
+ [DTRACE='$(top_srcdir)/util/dtrace.sh'])
+
+AC_SUBST([DTRACE])
+
+
#
# Files to configure. These are listed here because we used to
# specify them as arguments to AC_OUTPUT.
$(MANPAGES_RST) \
$(MANPAGES_IN)
-CLEANFILES = \
+CLEANFILES += \
$(man_MANS)
#
$(LIBDNS_LIBS) \
$(LIBISCCFG_LIBS)
-BUILT_SOURCES = \
+BUILT_SOURCES += \
$(OPTIONS_FILES)
rndc.grammar: cfg_test
rdatastruct.h
gen.dSYM
dnstap.pb-c.c
-dnstap.pb-c.h
\ No newline at end of file
+dnstap.pb-c.h
+/probes.h
$(nodist_libdns_la_HEADERS) \
code.h
-BUILT_SOURCES = \
+BUILT_SOURCES += \
$(nodist_libdns_la_SOURCES)
-CLEANFILES = \
+CLEANFILES += \
$(nodist_libdns_la_SOURCES) \
gen$(BUILD_EXEEXT)
include/dns/ssu.h \
include/dns/stats.h \
include/dns/time.h \
+ include/dns/trace.h \
include/dns/transport.h \
include/dns/tkey.h \
include/dns/trace.h \
order.c \
peer.c \
private.c \
+ probes.d \
qp.c \
qp_p.h \
rbt.c \
libdns_la_CPPFLAGS += $(LMDB_CFLAGS)
libdns_la_LIBADD += $(LMDB_LIBS)
endif
+
+if !HAVE_SYSTEMTAP
+DTRACE_DEPS = libdns_la-xfrin.lo
+DTRACE_OBJS = .libs/libdns_la-xfrin.$(OBJEXT)
+endif
+
+include $(top_srcdir)/Makefile.dtrace
+
+libdns_la_LIBADD += $(DTRACE_LIBADD)
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+provider libdns {
+};
picohttpparser.c \
picohttpparser.h \
portset.c \
+ probes.d \
quota.c \
radix.c \
random.c \
libisc_la_LIBADD += \
$(LIBXML2_LIBS)
endif HAVE_LIBXML2
+
+if !HAVE_SYSTEMTAP
+DTRACE_DEPS = libisc_la-rwlock.lo libisc_la-job.lo
+DTRACE_OBJS = .libs/libisc_la-rwlock.$(OBJEXT) .libs/libisc_la-job.$(OBJEXT)
+endif
+
+include $(top_srcdir)/Makefile.dtrace
+
+libisc_la_LIBADD += $(DTRACE_LIBADD)
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+provider libisc {
+};
listenlist.c \
log.c \
notify.c \
+ probes.d \
query.c \
server.c \
sortlist.c \
libns_la_LDFLAGS = \
$(AM_LDFLAGS) \
-release "$(PACKAGE_VERSION)"
+
+if !HAVE_SYSTEMTAP
+DTRACE_DEPS = libns_la-query.lo
+DTRACE_OBJS = .libs/libns_la-query.$(OBJEXT)
+endif
+
+include $(top_srcdir)/Makefile.dtrace
+
+libns_la_LIBADD += $(DTRACE_LIBADD)
--- /dev/null
+/*
+ * Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+ *
+ * SPDX-License-Identifier: MPL-2.0
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, you can obtain one at https://mozilla.org/MPL/2.0/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+provider libns {
+};
zonemgr_test \
zt_test
-CLEANFILES =
-
if HAVE_PERL
check_PROGRAMS += \
--- /dev/null
+#!/bin/sh
+
+# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
+#
+# SPDX-License-Identifier: MPL-2.0
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, you can obtain one at https://mozilla.org/MPL/2.0/.
+#
+# See the COPYRIGHT file distributed with this work for additional
+# information regarding copyright ownership.
+
+USAGE="# Usage: ${0} [-h | -G] -s File.d [-o <File>]"
+
+mode=
+while getopts hGs:o: opt; do
+ case "${opt}" in
+ h) mode=header ;;
+ s) input=$OPTARG ;;
+ o) output=$OPTARG ;;
+ G) mode=object ;;
+ \?) echo $USAGE; exit 1;;
+ esac
+done
+shift $((OPTIND - 1))
+
+if test -z "${mode}" || test -z "${input}"; then
+ echo $USAGE; exit 1;
+fi
+
+case "${mode}" in
+ header)
+ if test -z "${output}"; then
+ output="$(basename "${input}" .d).h"
+ fi
+ PROVIDER=$(cat "${input}" | sed -ne 's/^provider \(.*\) {/\1/p' | tr "a-z" "A-Z")
+ sed -ne 's/.*probe \(.*\)(.*);/\1/p' "${input}" | tr "a-z" "A-Z" | while read PROBE; do
+ echo "#define ${PROVIDER}_${PROBE}_ENABLED() 0";
+ echo "#define ${PROVIDER}_${PROBE}(...)";
+ done > "${output}"
+ ;;
+ object)
+ if test -z "${output}"; then
+ output="$(basename "${input}" .d).o"
+ fi
+ echo "extern int empty;" | gcc -xc -c - -fPIC -DPIC -o "${output}"
+ ;;
+esac