From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Calvin Owens <calvin@wbinvd.org>,
Artem Bityutskiy <artem.bityutskiy@linux.intel.com>,
Len Brown <len.brown@intel.com>, Sasha Levin <sashal@kernel.org>,
lenb@kernel.org, linux-pm@vger.kernel.org
Subject: [PATCH AUTOSEL 6.16-6.12] tools/power turbostat: Fix build with musl
Date: Sun, 10 Aug 2025 12:51:54 -0400 [thread overview]
Message-ID: <20250810165158.1888206-12-sashal@kernel.org> (raw)
In-Reply-To: <20250810165158.1888206-1-sashal@kernel.org>
From: Calvin Owens <calvin@wbinvd.org>
[ Upstream commit 6ea0ec1b958a84aff9f03fb0ae4613a4d5bed3ea ]
turbostat.c: In function 'parse_int_file':
turbostat.c:5567:19: error: 'PATH_MAX' undeclared (first use in this function)
5567 | char path[PATH_MAX];
| ^~~~~~~~
turbostat.c: In function 'probe_graphics':
turbostat.c:6787:19: error: 'PATH_MAX' undeclared (first use in this function)
6787 | char path[PATH_MAX];
| ^~~~~~~~
Signed-off-by: Calvin Owens <calvin@wbinvd.org>
Reviewed-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
**Backport Status: YES**
This commit should be backported to stable kernel trees for the
following reasons:
1. **Clear Build Fix**: This is a straightforward build fix that
addresses compilation failures when building turbostat with musl
libc. The error messages in the commit clearly show `PATH_MAX` is
undeclared, which prevents the tool from compiling.
2. **Minimal and Safe Change**: The fix is extremely minimal - it only
adds a single include directive (`#include <limits.h>`) at line 70 of
turbostat.c. This is a standard POSIX header that defines `PATH_MAX`
and other system limits.
3. **No Functional Changes**: The commit doesn't change any logic or
behavior - it simply ensures the code compiles correctly by including
the necessary header file that defines `PATH_MAX`.
4. **Affects User Tools**: While turbostat is a userspace tool (not
kernel code), it's an important power monitoring utility that's part
of the kernel source tree. Users building kernel tools with musl libc
(common in embedded systems, Alpine Linux, etc.) would be unable to
build this tool without this fix.
5. **Cross-Platform Compatibility**: The issue affects systems using
musl libc instead of glibc. With glibc, `PATH_MAX` might be defined
through indirect includes, but musl requires explicit inclusion of
`<limits.h>`. This fix improves portability.
6. **No Risk of Regression**: Adding the `<limits.h>` include has zero
risk of breaking existing functionality. The header is standard and
the constant `PATH_MAX` is used in at least 4 places in the code
(lines 5641, 6870, 7481, 7537) where character arrays are declared.
7. **Follows Stable Rules**: This perfectly fits the stable kernel
criteria:
- Fixes a real bug (build failure)
- Obviously correct (standard header inclusion)
- Already tested (has sign-offs and review)
- Small change (1 line)
- No new features or architectural changes
The commit is an ideal candidate for stable backporting as it fixes a
concrete build issue with minimal risk and maximum benefit for users of
alternative libc implementations.
tools/power/x86/turbostat/turbostat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/power/x86/turbostat/turbostat.c b/tools/power/x86/turbostat/turbostat.c
index bf011c2847f2..46ee85216373 100644
--- a/tools/power/x86/turbostat/turbostat.c
+++ b/tools/power/x86/turbostat/turbostat.c
@@ -67,6 +67,7 @@
#include <stdbool.h>
#include <assert.h>
#include <linux/kernel.h>
+#include <limits.h>
#define UNUSED(x) (void)(x)
--
2.39.5
next prev parent reply other threads:[~2025-08-10 16:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-10 16:51 [PATCH AUTOSEL 6.16-5.10] block: avoid possible overflow for chunk_sectors check in blk_stack_limits() Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-6.12] tools/power turbostat: Handle non-root legacy-uncore sysfs permissions Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-6.12] ALSA: hda/realtek: add LG gram 16Z90R-A to alc269 fixup table Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-6.12] lib/sbitmap: convert shallow_depth from one word to the whole sbitmap Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-6.1] ASoC: Intel: avs: Fix uninitialized pointer error in probe() Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-6.12] smb: client: don't call init_waitqueue_head(&info->conn_wait) twice in _smbd_get_connection Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-5.4] pNFS: Fix stripe mapping in block/scsi layout Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-5.4] pNFS: Fix uninited ptr deref " Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-5.4] net: phy: smsc: add proper reset flags for LAN8710A Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-6.15] ASoC: Intel: sof_sdw: Add quirk for Alienware Area 51 (2025) 0CCC SKU Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16] regmap: irq: Free the regmap-irq mutex Sasha Levin
2025-08-10 16:51 ` Sasha Levin [this message]
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16] irqchip/mvebu-gicp: Clear pending interrupts on init Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-5.4] pNFS: Fix disk addr range check in block/scsi layout Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-6.12] tools/power turbostat: Handle cap_get_proc() ENOSYS Sasha Levin
2025-08-10 16:51 ` [PATCH AUTOSEL 6.16-5.4] pNFS: Handle RPC size limit for layoutcommits Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250810165158.1888206-12-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=artem.bityutskiy@linux.intel.com \
--cc=calvin@wbinvd.org \
--cc=len.brown@intel.com \
--cc=lenb@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox