Blob Blame History Raw
From 769b79f04163b8467f4acf24963c82ad17180885 Mon Sep 17 00:00:00 2001
From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Wed, 9 Oct 2019 20:06:15 +0200
Subject: [PATCH 53/76] xlat: provide fallback definitions for UFFD_FEATURE_*
 constants

* xlat/uffd_api_features.in: Add fallback definitions.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1758201
---
 xlat/uffd_api_features.in | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Index: strace-5.1/xlat/uffd_api_features.in
===================================================================
--- strace-5.1.orig/xlat/uffd_api_features.in	2017-09-17 14:04:11.000000000 +0200
+++ strace-5.1/xlat/uffd_api_features.in	2020-01-29 12:06:42.473425856 +0100
@@ -1,10 +1,10 @@
 #val_type uint64_t
-UFFD_FEATURE_PAGEFAULT_FLAG_WP
-UFFD_FEATURE_EVENT_FORK
-UFFD_FEATURE_EVENT_REMAP
-UFFD_FEATURE_EVENT_REMOVE
-UFFD_FEATURE_MISSING_HUGETLBFS
-UFFD_FEATURE_MISSING_SHMEM
-UFFD_FEATURE_EVENT_UNMAP
-UFFD_FEATURE_SIGBUS
-UFFD_FEATURE_THREAD_ID
+UFFD_FEATURE_PAGEFAULT_FLAG_WP	(1<<0)
+UFFD_FEATURE_EVENT_FORK		(1<<1)
+UFFD_FEATURE_EVENT_REMAP	(1<<2)
+UFFD_FEATURE_EVENT_REMOVE	(1<<3)
+UFFD_FEATURE_MISSING_HUGETLBFS	(1<<4)
+UFFD_FEATURE_MISSING_SHMEM	(1<<5)
+UFFD_FEATURE_EVENT_UNMAP	(1<<6)
+UFFD_FEATURE_SIGBUS		(1<<7)
+UFFD_FEATURE_THREAD_ID		(1<<8)
Index: strace-5.1/xlat/uffd_api_features.h
===================================================================
--- strace-5.1.orig/xlat/uffd_api_features.h	2019-05-22 15:08:31.000000000 +0200
+++ strace-5.1/xlat/uffd_api_features.h	2020-01-29 12:07:13.199158142 +0100
@@ -3,44 +3,89 @@
 #include "gcc_compat.h"
 #include "static_assert.h"
 
-
-#ifndef XLAT_MACROS_ONLY
-
-# ifdef IN_MPERS
-
-#  error static const struct xlat uffd_api_features in mpers mode
-
-# else
-
-static
-const struct xlat uffd_api_features[] = {
 #if defined(UFFD_FEATURE_PAGEFAULT_FLAG_WP) || (defined(HAVE_DECL_UFFD_FEATURE_PAGEFAULT_FLAG_WP) && HAVE_DECL_UFFD_FEATURE_PAGEFAULT_FLAG_WP)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_PAGEFAULT_FLAG_WP),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_PAGEFAULT_FLAG_WP) == ((1<<0)), "UFFD_FEATURE_PAGEFAULT_FLAG_WP != (1<<0)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_PAGEFAULT_FLAG_WP (1<<0)
 #endif
 #if defined(UFFD_FEATURE_EVENT_FORK) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_FORK) && HAVE_DECL_UFFD_FEATURE_EVENT_FORK)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_FORK),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_EVENT_FORK) == ((1<<1)), "UFFD_FEATURE_EVENT_FORK != (1<<1)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_EVENT_FORK (1<<1)
 #endif
 #if defined(UFFD_FEATURE_EVENT_REMAP) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_REMAP) && HAVE_DECL_UFFD_FEATURE_EVENT_REMAP)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMAP),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_EVENT_REMAP) == ((1<<2)), "UFFD_FEATURE_EVENT_REMAP != (1<<2)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_EVENT_REMAP (1<<2)
 #endif
 #if defined(UFFD_FEATURE_EVENT_REMOVE) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_REMOVE) && HAVE_DECL_UFFD_FEATURE_EVENT_REMOVE)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMOVE),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_EVENT_REMOVE) == ((1<<3)), "UFFD_FEATURE_EVENT_REMOVE != (1<<3)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_EVENT_REMOVE (1<<3)
 #endif
 #if defined(UFFD_FEATURE_MISSING_HUGETLBFS) || (defined(HAVE_DECL_UFFD_FEATURE_MISSING_HUGETLBFS) && HAVE_DECL_UFFD_FEATURE_MISSING_HUGETLBFS)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_HUGETLBFS),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_MISSING_HUGETLBFS) == ((1<<4)), "UFFD_FEATURE_MISSING_HUGETLBFS != (1<<4)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_MISSING_HUGETLBFS (1<<4)
 #endif
 #if defined(UFFD_FEATURE_MISSING_SHMEM) || (defined(HAVE_DECL_UFFD_FEATURE_MISSING_SHMEM) && HAVE_DECL_UFFD_FEATURE_MISSING_SHMEM)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_SHMEM),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_MISSING_SHMEM) == ((1<<5)), "UFFD_FEATURE_MISSING_SHMEM != (1<<5)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_MISSING_SHMEM (1<<5)
 #endif
 #if defined(UFFD_FEATURE_EVENT_UNMAP) || (defined(HAVE_DECL_UFFD_FEATURE_EVENT_UNMAP) && HAVE_DECL_UFFD_FEATURE_EVENT_UNMAP)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_UNMAP),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_EVENT_UNMAP) == ((1<<6)), "UFFD_FEATURE_EVENT_UNMAP != (1<<6)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_EVENT_UNMAP (1<<6)
 #endif
 #if defined(UFFD_FEATURE_SIGBUS) || (defined(HAVE_DECL_UFFD_FEATURE_SIGBUS) && HAVE_DECL_UFFD_FEATURE_SIGBUS)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_SIGBUS),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_SIGBUS) == ((1<<7)), "UFFD_FEATURE_SIGBUS != (1<<7)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_SIGBUS (1<<7)
 #endif
 #if defined(UFFD_FEATURE_THREAD_ID) || (defined(HAVE_DECL_UFFD_FEATURE_THREAD_ID) && HAVE_DECL_UFFD_FEATURE_THREAD_ID)
-  XLAT_TYPE(uint64_t, UFFD_FEATURE_THREAD_ID),
+DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE
+static_assert((UFFD_FEATURE_THREAD_ID) == ((1<<8)), "UFFD_FEATURE_THREAD_ID != (1<<8)");
+DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE
+#else
+# define UFFD_FEATURE_THREAD_ID (1<<8)
 #endif
+
+#ifndef XLAT_MACROS_ONLY
+
+# ifdef IN_MPERS
+
+#  error static const struct xlat uffd_api_features in mpers mode
+
+# else
+
+static
+const struct xlat uffd_api_features[] = {
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_PAGEFAULT_FLAG_WP),
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_FORK),
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMAP),
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_REMOVE),
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_HUGETLBFS),
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_MISSING_SHMEM),
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_EVENT_UNMAP),
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_SIGBUS),
+ XLAT_TYPE(uint64_t, UFFD_FEATURE_THREAD_ID),
  XLAT_END
 };