[DTrace-devel] [PATCH v4 06/25] uapi headers: include <sys/dtrace_types> as needed

Nick Alcock nick.alcock at oracle.com
Fri Oct 7 10:25:06 UTC 2022


This is needed for _LITTLE_ENDIAN and _BIG_ENDIAN.

Add a new internals test to identify this class of failure: add a
tag 'uninstalled' which is disabled in the installed tree to prevent it
from being executed as part of the installed testsuite (since it is not
particularly useful outside the installed set, and making it work in
both places would be complicated and annoying).

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
 include/dtrace/actions_defines.h              |  1 +
 include/dtrace/dof_defines.h                  |  3 +-
 test/Build                                    |  1 +
 .../headers/tst.header-endianness.sh          | 30 +++++++++++++++++++
 4 files changed, 34 insertions(+), 1 deletion(-)
 create mode 100755 test/internals/headers/tst.header-endianness.sh

diff --git a/include/dtrace/actions_defines.h b/include/dtrace/actions_defines.h
index dfec34f3ddc2..f161df7cf13f 100644
--- a/include/dtrace/actions_defines.h
+++ b/include/dtrace/actions_defines.h
@@ -13,6 +13,7 @@
 #ifndef _DTRACE_ACTIONS_DEFINES_H
 #define _DTRACE_ACTIONS_DEFINES_H
 
+#include <sys/dtrace_types.h>
 #include <dtrace/universal.h>
 
 /*
diff --git a/include/dtrace/dof_defines.h b/include/dtrace/dof_defines.h
index 02d650c22831..4a7c4185fa4b 100644
--- a/include/dtrace/dof_defines.h
+++ b/include/dtrace/dof_defines.h
@@ -2,7 +2,7 @@
  * Licensed under the Universal Permissive License v 1.0 as shown at
  * http://oss.oracle.com/licenses/upl.
  *
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
  */
 
 /*
@@ -13,6 +13,7 @@
 #ifndef _DTRACE_DOF_DEFINES_H
 #define _DTRACE_DOF_DEFINES_H
 
+#include <sys/dtrace_types.h>
 #include <dtrace/universal.h>
 
 /*
diff --git a/test/Build b/test/Build
index 853fcc7998da..d372da800f8a 100644
--- a/test/Build
+++ b/test/Build
@@ -12,6 +12,7 @@ install-test::
 		cp -a $$name "$(INSTTESTDIR)/test/$$(basename $$name)"; \
 		chown -R root:root "$(INSTTESTDIR)/test/$$(basename $$name)" 2>/dev/null || true; \
 	done
+	echo '!uninstalled' >> $(INSTTESTDIR)/test/tags.default
 
 include test/triggers/Build
 include test/utils/Build
diff --git a/test/internals/headers/tst.header-endianness.sh b/test/internals/headers/tst.header-endianness.sh
new file mode 100755
index 000000000000..0ac45621010c
--- /dev/null
+++ b/test/internals/headers/tst.header-endianness.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Oracle Linux DTrace.
+# Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+# Licensed under the Universal Permissive License v 1.0 as shown at
+# http://oss.oracle.com/licenses/upl.
+#
+# @@tags: uninstalled
+
+set -e
+
+dtrace=$1
+CC=/usr/bin/gcc
+OLDDIRNAME=`pwd`
+CFLAGS="-I${PWD}/include"
+
+DIRNAME="$tmpdir/usdt-entryreturn.$$.$RANDOM"
+mkdir -p $DIRNAME
+cd $DIRNAME
+
+for header in ${OLDDIRNAME}/include/dtrace/*.h; do
+    grep -q _ENDIAN $header || continue
+    cat > test.c <<EOF
+    #include "$header"
+    #if !defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
+    #error $header: needs to include <sys/dtrace_types.h>
+    #endif
+EOF
+    $CC -c $CFLAGS -o /dev/null test.c
+done
-- 
2.35.1




More information about the DTrace-devel mailing list