Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Missing explicit header inclusion for <fcntl.h> when using POSIX constants (O_RDONLY, O_DIRECTORY) and functions (open, openat) in tools/perf/util/header.c.
--
--- Patch [3]: [PATCH v5 3/6] perf header: Support memory ranges ---
commit 3413492c0a2a11d41de6c16475e806b307c1b825
Author: Thomas Falcon <[email protected]>
perf header: Support memory ranges
This commit adds support for reading memory range data from the ACPI MRRM
table exposed via sysfs. It saves this data in the perf data file header
under a new feature bit, HEADER_MEMORY_RANGES, and adds support to print it.
Link: https://lore.kernel.org/lkml/[email protected]/
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 091d8f7f6bd2c..a81a0f42bb0f9 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
[ ... ]
> @@ -1891,6 +1892,132 @@ static int write_cpu_domain_info(struct feat_fd *ff,
> return ret;
> }
>
> +static int memory_range__read(struct memory_range *range, const char *path)
> +{
> + char buf[32];
> + ssize_t n;
> + int dfd, fd, tmp, ret = -1;
> +
> + dfd = open(path, O_RDONLY | O_DIRECTORY);
> + if (dfd < 0)
> + return -1;
> +
> +#define _R(name, dst, conv) \
> + fd = openat(dfd, name, O_RDONLY); \
[Severity: Medium]
Will this compile successfully on systems using musl libc?
The code introduces usage of POSIX functions and constants such as open,
openat, O_RDONLY, and O_DIRECTORY without explicitly including <fcntl.h>.
While glibc often implicitly includes these dependencies through other headers,
musl strictly separates declarations. This missing include could lead to build
failures in musl environments.
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.