[PATCH] perf parse-events: Include errno.h before kernel headers

From: Florian Fainelli

Date: Mon Oct 26 2026 - 13:49:35 EST


Building perf against uClibc fails in config_term_common():

util/parse-events.c:954:30: error: 'ERANGE' undeclared

The kernel headers included before errno.h pull in asm/errno.h. uClibc's
bits/errno.h undefines EDOM, EILSEQ and ERANGE before including
linux/errno.h, but the kernel header include guards prevent these macros
from being defined again.

Include errno.h before the kernel headers so ERANGE remains defined.

Fixes: 6b9c0261b3fb ("perf record: Add ratio-to-prev term")
Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
---
tools/perf/util/parse-events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index cc7ad331a49f..efb46ba9ba22 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
+#include <errno.h>
#include <linux/hw_breakpoint.h>
#include <linux/err.h>
#include <linux/list_sort.h>
#include <linux/zalloc.h>
#include <dirent.h>
-#include <errno.h>
#include <sys/ioctl.h>
#include <sys/param.h>
#include "cpumap.h"
--
2.53.0