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

Nick Alcock nick.alcock at oracle.com
Wed Sep 7 12:59:54 UTC 2022


This is needed for _LITTLE_ENDIAN and _BIG_ENDIAN.

Add a new internals test to identify this class of failure.

Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
 include/dtrace/actions_defines.h              |  1 +
 include/dtrace/dof_defines.h                  |  3 +-
 .../headers/tst.header-endianness.sh          | 29 +++++++++++++++++++
 3 files changed, 32 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/internals/headers/tst.header-endianness.sh b/test/internals/headers/tst.header-endianness.sh
new file mode 100755
index 000000000000..18c3fb0b26be
--- /dev/null
+++ b/test/internals/headers/tst.header-endianness.sh
@@ -0,0 +1,29 @@
+#!/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.
+#
+
+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.37.1.265.g363c192786.dirty




More information about the DTrace-devel mailing list