[PATCH 1/3] perf trace: Include copied headers in the beauty directory

From: Namhyung Kim

Date: Sun May 24 2026 - 21:11:54 EST


We keep uptodate copied of the kernel headers, let's use it directly and
don't worry about missing definitions.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/trace/beauty/clone.c | 7 ++++---
tools/perf/trace/beauty/fcntl.c | 19 ++-----------------
tools/perf/trace/beauty/fs_at_flags.c | 12 ++----------
tools/perf/trace/beauty/fsmount.c | 11 ++---------
tools/perf/trace/beauty/sched_policy.c | 10 +---------
tools/perf/trace/beauty/sync_file_range.c | 12 ++----------
6 files changed, 13 insertions(+), 58 deletions(-)

diff --git a/tools/perf/trace/beauty/clone.c b/tools/perf/trace/beauty/clone.c
index c9fa8f7e82b909fb..c80f800a45d04793 100644
--- a/tools/perf/trace/beauty/clone.c
+++ b/tools/perf/trace/beauty/clone.c
@@ -1,15 +1,16 @@
// SPDX-License-Identifier: LGPL-2.1
/*
- * trace/beauty/cone.c
+ * trace/beauty/clone.c
*
* Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
*/

-#include "trace/beauty/beauty.h"
#include <linux/kernel.h>
#include <linux/log2.h>
#include <sys/types.h>
-#include <sched.h>
+#include "trace/beauty/beauty.h"
+#include "trace/beauty/include/uapi/linux/sched.h"
+

static size_t clone__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool show_prefix)
{
diff --git a/tools/perf/trace/beauty/fcntl.c b/tools/perf/trace/beauty/fcntl.c
index e1b99b8f55eb0d7c..10fd6a2b75c353c4 100644
--- a/tools/perf/trace/beauty/fcntl.c
+++ b/tools/perf/trace/beauty/fcntl.c
@@ -5,25 +5,10 @@
* Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
*/

-#include "trace/beauty/beauty.h"
#include <linux/kernel.h>
-#include <linux/fcntl.h>
-
-#ifndef F_GET_RW_HINT
-#define F_GET_RW_HINT (F_LINUX_SPECIFIC_BASE + 11)
-#endif
-
-#ifndef F_SET_RW_HINT
-#define F_SET_RW_HINT (F_LINUX_SPECIFIC_BASE + 12)
-#endif
-
-#ifndef F_GET_FILE_RW_HINT
-#define F_GET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 13)
-#endif
+#include "trace/beauty/beauty.h"
+#include "trace/beauty/include/uapi/linux/fcntl.h"

-#ifndef F_SET_FILE_RW_HINT
-#define F_SET_FILE_RW_HINT (F_LINUX_SPECIFIC_BASE + 14)
-#endif

static size_t fcntl__scnprintf_getfd(unsigned long val, char *bf, size_t size, bool show_prefix)
{
diff --git a/tools/perf/trace/beauty/fs_at_flags.c b/tools/perf/trace/beauty/fs_at_flags.c
index c200669cb944a417..085a3ba399a41dd4 100644
--- a/tools/perf/trace/beauty/fs_at_flags.c
+++ b/tools/perf/trace/beauty/fs_at_flags.c
@@ -5,18 +5,10 @@
* Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
*/

-#include "trace/beauty/beauty.h"
#include <sys/types.h>
-#include <linux/fcntl.h>
#include <linux/log2.h>
-
-/*
- * uapi/linux/fcntl.h does not keep a copy in tools headers directory,
- * for system with kernel versions before v5.8, need to sync AT_EACCESS macro.
- */
-#ifndef AT_EACCESS
-#define AT_EACCESS 0x200
-#endif
+#include "trace/beauty/beauty.h"
+#include "trace/beauty/include/uapi/linux/fcntl.h"

#include "trace/beauty/generated/fs_at_flags_array.c"
static DEFINE_STRARRAY(fs_at_flags, "AT_");
diff --git a/tools/perf/trace/beauty/fsmount.c b/tools/perf/trace/beauty/fsmount.c
index 179e649fc72a4724..a84e3f9749ca97fc 100644
--- a/tools/perf/trace/beauty/fsmount.c
+++ b/tools/perf/trace/beauty/fsmount.c
@@ -5,16 +5,9 @@
* Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
*/

-#include "trace/beauty/beauty.h"
#include <linux/log2.h>
-#include <sys/mount.h>
-
-#ifndef MOUNT_ATTR__ATIME
-#define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */
-#endif
-#ifndef MOUNT_ATTR_RELATIME
-#define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */
-#endif
+#include "trace/beauty/beauty.h"
+#include "trace/beauty/include/uapi/linux/mount.h"


static size_t fsmount__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool show_prefix)
diff --git a/tools/perf/trace/beauty/sched_policy.c b/tools/perf/trace/beauty/sched_policy.c
index 3fb6d9e0fae9b4e6..f8c8d297c95fbdd1 100644
--- a/tools/perf/trace/beauty/sched_policy.c
+++ b/tools/perf/trace/beauty/sched_policy.c
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: LGPL-2.1
#include "trace/beauty/beauty.h"
-
-#include <sched.h>
+#include "trace/beauty/include/uapi/linux/sched.h"

/*
* Not defined anywhere else, probably, just to make sure we
@@ -9,13 +8,6 @@
*/
#define SCHED_POLICY_MASK 0xff

-#ifndef SCHED_DEADLINE
-#define SCHED_DEADLINE 6
-#endif
-#ifndef SCHED_RESET_ON_FORK
-#define SCHED_RESET_ON_FORK 0x40000000
-#endif
-
size_t syscall_arg__scnprintf_sched_policy(char *bf, size_t size,
struct syscall_arg *arg)
{
diff --git a/tools/perf/trace/beauty/sync_file_range.c b/tools/perf/trace/beauty/sync_file_range.c
index 3e8f50ff4fc701f9..50a6c458dff704fa 100644
--- a/tools/perf/trace/beauty/sync_file_range.c
+++ b/tools/perf/trace/beauty/sync_file_range.c
@@ -5,18 +5,10 @@
* Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
*/

-#include "trace/beauty/beauty.h"
#include <linux/log2.h>
-#include <linux/fs.h>
+#include "trace/beauty/beauty.h"
+#include "trace/beauty/include/uapi/linux/fs.h"

-#ifndef SYNC_FILE_RANGE_WRITE_AND_WAIT
-#define SYNC_FILE_RANGE_WAIT_BEFORE 1
-#define SYNC_FILE_RANGE_WRITE 2
-#define SYNC_FILE_RANGE_WAIT_AFTER 4
-#define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | \
- SYNC_FILE_RANGE_WAIT_BEFORE | \
- SYNC_FILE_RANGE_WAIT_AFTER)
-#endif

static size_t sync_file_range__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool show_prefix)
{
--
2.54.0.746.g67dd491aae-goog