diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-04 11:05:57 -0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-04-04 13:18:17 -0300 |
commit | 9e03608e93858620317d54bc88a9a0069bce003d (patch) | |
tree | ae65e7ee439c44b94375e897c086c0bb809337e9 /tools/build | |
parent | 430635a0ef1ce958b7b4311f172694ece2c692b8 (diff) | |
download | linux-stable-9e03608e93858620317d54bc88a9a0069bce003d.tar.gz linux-stable-9e03608e93858620317d54bc88a9a0069bce003d.tar.bz2 linux-stable-9e03608e93858620317d54bc88a9a0069bce003d.zip |
tools build: Add a feature test for scandirat(), that is not implemented so far in musl and uclibc
We use it just when listing tracepoint events, and for root, so just
emit a warning about it to get users to ask the library maintainers to
implement it, as suggested in this systemd ticket:
https://github.com/systemd/casync/issues/129
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/ZCwv4z5Dh%2FdHUMG6@kernel.org/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/build')
-rw-r--r-- | tools/build/Makefile.feature | 1 | ||||
-rw-r--r-- | tools/build/feature/Makefile | 4 | ||||
-rw-r--r-- | tools/build/feature/test-all.c | 5 | ||||
-rw-r--r-- | tools/build/feature/test-scandirat.c | 13 |
4 files changed, 23 insertions, 0 deletions
diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature index 214622d7537c..934e2777a2db 100644 --- a/tools/build/Makefile.feature +++ b/tools/build/Makefile.feature @@ -64,6 +64,7 @@ FEATURE_TESTS_BASIC := \ lzma \ get_cpuid \ bpf \ + scandirat \ sched_getcpu \ sdt \ setns \ diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile index 0a3b9281f8b0..0f0aa9b7d7b5 100644 --- a/tools/build/feature/Makefile +++ b/tools/build/feature/Makefile @@ -65,6 +65,7 @@ FILES= \ test-gettid.bin \ test-jvmti.bin \ test-jvmti-cmlr.bin \ + test-scandirat.bin \ test-sched_getcpu.bin \ test-setns.bin \ test-libopencsd.bin \ @@ -129,6 +130,9 @@ $(OUTPUT)test-get_current_dir_name.bin: $(OUTPUT)test-glibc.bin: $(BUILD) +$(OUTPUT)test-scandirat.bin: + $(BUILD) + $(OUTPUT)test-sched_getcpu.bin: $(BUILD) diff --git a/tools/build/feature/test-all.c b/tools/build/feature/test-all.c index 957c02c7b163..6f4bf386a3b5 100644 --- a/tools/build/feature/test-all.c +++ b/tools/build/feature/test-all.c @@ -114,6 +114,10 @@ # include "test-pthread-barrier.c" #undef main +#define main main_test_scandirat +# include "test-scandirat.c" +#undef main + #define main main_test_sched_getcpu # include "test-sched_getcpu.c" #undef main @@ -206,6 +210,7 @@ int main(int argc, char *argv[]) main_test_get_cpuid(); main_test_bpf(); main_test_libcrypto(); + main_test_scandirat(); main_test_sched_getcpu(); main_test_sdt(); main_test_setns(); diff --git a/tools/build/feature/test-scandirat.c b/tools/build/feature/test-scandirat.c new file mode 100644 index 000000000000..d7e19e1858a5 --- /dev/null +++ b/tools/build/feature/test-scandirat.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <dirent.h> + +int main(void) +{ + // expects non-NULL, arg3 is 'restrict' so "pointers" have to be different + return scandirat(/*dirfd=*/ 0, /*dirp=*/ (void *)1, /*namelist=*/ (void *)2, /*filter=*/ (void *)3, /*compar=*/ (void *)4); +} + +#undef _GNU_SOURCE |